Skip to content

Commit

Permalink
Fix: 'python' highlighting when not used as a keyword
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
idillon-sfl committed Nov 20, 2024
1 parent b65b6c7 commit b24a574
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion client/syntaxes/bitbake.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions client/test/grammars/test-cases/functions.bb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
14 changes: 7 additions & 7 deletions client/test/grammars/test-cases/keywords.bb
Original file line number Diff line number Diff line change
Expand Up @@ -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
python(){}
#<------ source.bb storage.type.function.python.bb

0 comments on commit b24a574

Please sign in to comment.