-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Add Sourcepawn language support #9304
base: master
Are you sure you want to change the base?
Conversation
c61ac11
to
1a954cc
Compare
|
||
(array_indexed_access) @punctuation.bracket | ||
|
||
(escape_sequence) @string.escape |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(escape_sequence) @string.escape | |
(escape_sequence) @constant.character.escape |
the captures should line up with https://docs.helix-editor.com/master/themes.html#syntax-highlighting
name: (identifier) @type) | ||
|
||
(enum_struct_field | ||
name: (identifier) @variable.member) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name: (identifier) @variable.member) | |
name: (identifier) @variable.other.member) |
(int_literal) @number | ||
|
||
(char_literal) @character | ||
|
||
(float_literal) @number.float |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(int_literal) @number | |
(char_literal) @character | |
(float_literal) @number.float | |
(int_literal) @constant.numeric.integer | |
(char_literal) @constant.character | |
(float_literal) @constant.numeric.float |
|
||
(concatenated_string) @punctuation.delimiter | ||
|
||
(bool_literal) @boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(bool_literal) @boolean | |
(bool_literal) @constant.builtin.boolean |
"return" @keyword.return | ||
[ | ||
"if" | ||
"else" | ||
"case" | ||
"default" | ||
"switch" | ||
] @keyword.conditional | ||
[ | ||
"do" | ||
"while" | ||
"for" | ||
"continue" | ||
"break" | ||
] @keyword.repeat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"return" @keyword.return | |
[ | |
"if" | |
"else" | |
"case" | |
"default" | |
"switch" | |
] @keyword.conditional | |
[ | |
"do" | |
"while" | |
"for" | |
"continue" | |
"break" | |
] @keyword.repeat | |
"return" @keyword.control.return | |
[ | |
"if" | |
"else" | |
"case" | |
"default" | |
"switch" | |
] @keyword.control.conditional | |
[ | |
"do" | |
"while" | |
"for" | |
"continue" | |
"break" | |
] @keyword.control.repeat |
"static" | ||
"stock" | ||
"forward" | ||
] @type.qualifier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trailing newline is missing on a few files: highlights.scm
, injections.scm
and languages.toml
(identifier) @variable | ||
; Assume all-caps names are constants | ||
((identifier) @constant | ||
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$")) | |
(#match? @constant "^[A-Z][A-Z0-9_]+$")) |
#lua-match?
is specific to neovim
(identifier) @variable | ||
; Assume all-caps names are constants | ||
((identifier) @constant | ||
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two matches on (identifier)
should be at the bottom of the file rather than the top. In neovim the precedence of the queries is the opposite of what it is in Helix (and tree-sitter-cli): in Helix the higher patterns in the file take precedence over the lower ones. So as-written these (identifier)
matches will match before any of the patterns below that also match (identifier)
like on L7 or L10. You will also want to swap the order of these two matches since the one with the #match?
is more specific (so it should be higher precedence) than the one on L1.
(preproc_include) @keyword.import | ||
|
||
(preproc_tryinclude) @keyword.import |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(preproc_include) @keyword.import | |
(preproc_tryinclude) @keyword.import | |
(preproc_include) @keyword.control.import | |
(preproc_tryinclude) @keyword.control.import |
Hello, thank you very much for the feedback. I should have tested this PR before submitting it, I naively thought that helix queries were fully compatible with the new nvim-tree-sitter queries. Sorry about that. I will convert it to draft while I fix it. Is there a way to "easily" test queries? |
We don't have test cases but you can |
This PR adds a tree-sitter parser and queries for the Sourcepawn programming language.