From b24a5747cad59ab7c3757119361b5ec3829c2eea Mon Sep 17 00:00:00 2001 From: Io Andes Daza-Dillon Date: Fri, 15 Nov 2024 10:13:04 -0500 Subject: [PATCH] Fix: 'python' highlighting when not used as a keyword It seems vscode-tmgrammar-test does not remove '>' in the beginning of the test cases before executing them. It results that '>python' will not match with a regex such as '^python'. Hence some tests had to be modified. --- client/syntaxes/bitbake.tmLanguage.json | 2 +- client/test/grammars/test-cases/functions.bb | 4 ++-- client/test/grammars/test-cases/keywords.bb | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/client/syntaxes/bitbake.tmLanguage.json b/client/syntaxes/bitbake.tmLanguage.json index 30031dc6..2c9e2094 100644 --- a/client/syntaxes/bitbake.tmLanguage.json +++ b/client/syntaxes/bitbake.tmLanguage.json @@ -61,7 +61,7 @@ "include": "#python-keywords" }, { - "match": "\\b(python|def)\\b(\\(?)", + "match": "(?<=^|^fakeroot +)\\b(python|def)\\b", "captures": { "1": { "name": "storage.type.function.python.bb" diff --git a/client/test/grammars/test-cases/functions.bb b/client/test/grammars/test-cases/functions.bb index 96b5842a..67022a32 100644 --- a/client/test/grammars/test-cases/functions.bb +++ b/client/test/grammars/test-cases/functions.bb @@ -25,8 +25,8 @@ > else: > return "dependency" ->python () { -#^^^^^^ source.bb storage.type.function.python.bb - entity.name.function.python.bb +python () { +#<------ source.bb storage.type.function.python.bb - entity.name.function.python.bb > if d.getVar('SOMEVAR') == 'value': # ^^^^^^ source.bb entity.name.function.python.bb > d.setVar('ANOTHERVAR', 'value2') diff --git a/client/test/grammars/test-cases/keywords.bb b/client/test/grammars/test-cases/keywords.bb index 106fd0b5..0843e023 100644 --- a/client/test/grammars/test-cases/keywords.bb +++ b/client/test/grammars/test-cases/keywords.bb @@ -30,15 +30,15 @@ >INHERIT += "autotools pkgconfig" #^^^^^^^ source.bb keyword.control.bb ->fakeroot python foo3() {} -#^^^^^^^^ source.bb keyword.control.bb -# ^^^^^^ source.bb storage.type.function.python.bb +fakeroot python foo3() {} +#<-------- source.bb keyword.control.bb +# ^^^^^^ source.bb storage.type.function.python.bb ->python (){} -#^^^^^^ source.bb storage.type.function.python.bb +python (){} +#<------ source.bb storage.type.function.python.bb >inherit_defer foo2 #^^^^^^^^^^^^^ source.bb keyword.control.bb ->python(){} -#^^^^^^ source.bb storage.type.function.python.bb \ No newline at end of file +python(){} +#<------ source.bb storage.type.function.python.bb \ No newline at end of file