Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: 'python' highlighting when not a keyword #352

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
7 changes: 7 additions & 0 deletions client/test/grammars/snaps/keywords.bb
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ inherit_defer foo2

python(){}

test() {
test python
}

def test() {
python = "test"
}
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
WilsonZiweiWang marked this conversation as resolved.
Show resolved Hide resolved
> if d.getVar('SOMEVAR') == 'value':
# ^^^^^^ source.bb entity.name.function.python.bb
> d.setVar('ANOTHERVAR', 'value2')
Expand Down
24 changes: 17 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,25 @@
>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

>test() {
> test python
# ^^^^^^ source.bb variable.other.names.bb
>}

>def test() {
> python = "test"
# ^^^^^^ source.bb variable.other.names.bb
>}
Loading