forked from IndianBoy42/tree-sitter-just
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the query generator to support more flavors
Add new nvim queries, as well as support for Zed and Lapce.
- Loading branch information
Showing
36 changed files
with
1,717 additions
and
125 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
; File autogenerated by build-queries-nvim.py; do not edit | ||
|
||
; Define collapse points | ||
|
||
[ | ||
(recipe) | ||
(string) | ||
(external_command) | ||
] @fold | ||
(#trim! @fold) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
; File autogenerated by build-queries-nvim.py; do not edit | ||
|
||
; This file specifies how matched syntax patterns should be highlighted | ||
|
||
[ | ||
"export" | ||
"import" | ||
] @keyword.control.import | ||
|
||
"mod" @keyword.directive | ||
|
||
[ | ||
"alias" | ||
"set" | ||
"shell" | ||
] @keyword | ||
|
||
[ | ||
"if" | ||
"else" | ||
] @keyword.control.conditional | ||
|
||
; Variables | ||
|
||
(value (identifier) @variable) | ||
|
||
(alias left: (identifier) @variable) | ||
|
||
(assignment left: (identifier) @variable) | ||
|
||
; Functions | ||
|
||
(recipe_header name: (identifier) @function) | ||
|
||
(dependency name: (identifier) @function) | ||
|
||
(dependency_expression name: (identifier) @function) | ||
|
||
(function_call name: (identifier) @function) | ||
|
||
; Parameters | ||
|
||
(parameter name: (identifier) @variable.parameter) | ||
|
||
; Namespaces | ||
|
||
(module name: (identifier) @namespace) | ||
|
||
; Operators | ||
|
||
[ | ||
":=" | ||
"?" | ||
"==" | ||
"!=" | ||
"=~" | ||
"@" | ||
"=" | ||
"$" | ||
"*" | ||
"+" | ||
"&&" | ||
"@-" | ||
"-@" | ||
"-" | ||
"/" | ||
":" | ||
] @operator | ||
|
||
; Punctuation | ||
|
||
[ "," ] @punctuation.delimiter | ||
|
||
[ | ||
"{" | ||
"}" | ||
"[" | ||
"]" | ||
"(" | ||
")" | ||
"{{" | ||
"}}" | ||
] @punctuation.bracket | ||
|
||
[ "`" "```" ] @punctuation.special | ||
|
||
; Literals | ||
|
||
(boolean) @constant.builtin.boolean | ||
|
||
[ | ||
(string) | ||
(external_command) | ||
] @string | ||
|
||
(escape_sequence) @constant.character.escape | ||
|
||
; Comments | ||
|
||
; FIXME: add once all editors support it | ||
(comment) @comment.line | ||
|
||
(shebang) @comment | ||
|
||
; highlight known settings (filtering does not always work) | ||
(setting | ||
left: ((identifier) @keyword | ||
(#any-of? @keyword | ||
"allow-duplicate-recipes" | ||
"dotenv-filename" | ||
"dotenv-load" | ||
"dotenv-path" | ||
"export" | ||
"fallback" | ||
"ignore-comments" | ||
"positional-arguments" | ||
"shell" | ||
"tempdi" | ||
"windows-powershell" | ||
"windows-shell" | ||
))) | ||
|
||
; highlight known attributes (filtering does not always work) | ||
(attribute | ||
((identifier) @attribute | ||
(#any-of? @attribute | ||
"private" | ||
"allow-duplicate-recipes" | ||
"dotenv-filename" | ||
"dotenv-load" | ||
"dotenv-path" | ||
"export" | ||
"fallback" | ||
"ignore-comments" | ||
"positional-arguments" | ||
"shell" | ||
"tempdi" | ||
"windows-powershell" | ||
"windows-shell" | ||
))) | ||
|
||
; Numbers are part of the syntax tree, even if disallowed | ||
(numeric_error) @error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
; File autogenerated by build-queries-nvim.py; do not edit | ||
|
||
; This query | ||
; | ||
; Better documentation is in https://docs.helix-editor.com/guides/indent.html | ||
|
||
[ | ||
(recipe) | ||
(string) | ||
(external_command) | ||
] @indent @extend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
; File autogenerated by build-queries-nvim.py; do not edit | ||
|
||
; FIXME: these are not compatible with helix due to precedence | ||
|
||
; ================ Always applicable ================ | ||
|
||
((comment) @injection.content | ||
(#set! injection.language "comment")) | ||
|
||
(comment) @comment | ||
|
||
; Highlight the RHS of `=~` as regex | ||
((regex_literal (_) @injection.content) | ||
(#set! injection.language "regex")) | ||
|
||
; ================ Global defaults ================ | ||
|
||
; Default everything to be bash | ||
(recipe_body | ||
(#set! injection.language "bash") | ||
(#set! injection.include-children)) @injection.content | ||
|
||
(external_command | ||
(command_body) @injection.content | ||
(#set! injection.language "bash")) | ||
|
||
; ================ Global language specified ================ | ||
; Global language is set with something like one of the following: | ||
; | ||
; set shell := ["bash", "-c", ...] | ||
; set shell := ["pwsh.exe"] | ||
; | ||
; We can extract the first item of the array, but we can't extract the language | ||
; name from the string with something like regex. So instead we special case | ||
; two things: powershell, which is likely to come with a `.exe` attachment that | ||
; we need to strip, and everything else which hopefully has no extension. We | ||
; separate this with a `#match?`. | ||
; | ||
; Unfortunately, there also isn't a way to allow arbitrary nesting or | ||
; alternatively set "global" capture variables. So we can set this for item- | ||
; level external commands, but not for e.g. external commands within an | ||
; expression without getting _really_ annoying. Should at least look fine since | ||
; they default to bash. Limitations... | ||
; See https://github.com/tree-sitter/tree-sitter/issues/880 for more on that. | ||
|
||
(source_file | ||
(setting "shell" ":=" "[" (string) @_langstr | ||
(#match? @_langstr ".*(powershell|pwsh|cmd).*") | ||
(#set! injection.language "powershell")) | ||
[ | ||
(recipe | ||
(recipe_body (#set! injection.include-children)) @injection.content) | ||
|
||
(assignment | ||
(expression (value (external_command (command_body) @injection.content)))) | ||
]) | ||
|
||
(source_file | ||
(setting "shell" ":=" "[" (string) @injection.language | ||
(#not-match? @injection.language ".*(powershell|pwsh|cmd).*")) | ||
[ | ||
(recipe | ||
(recipe_body (#set! injection.include-children)) @injection.content) | ||
|
||
(assignment | ||
(expression (value (external_command (command_body) @injection.content)))) | ||
]) | ||
|
||
; ================ Recipe language specified ================ | ||
|
||
; Set highlighting for recipes that specify a language | ||
(recipe_body | ||
(shebang (language) @injection.language) | ||
(#set! injection.include-children)) @injection.content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
; File autogenerated by build-queries-nvim.py; do not edit | ||
|
||
; This file tells us about the scope of variables so e.g. local | ||
; variables override global functions with the same name | ||
|
||
; Scope | ||
|
||
(recipe) @local.scope | ||
|
||
; Definitions | ||
|
||
(alias left: (identifier) @local.definition.variable) | ||
|
||
(assignment left: (identifier) @local.definition.variable) | ||
|
||
(module name: (identifier) @local.definition.namespace) | ||
|
||
(parameter name: (identifier) @local.definition.variable) | ||
|
||
(recipe_header name: (identifier) @local.definition.function) | ||
|
||
; References | ||
|
||
(alias right: (identifier) @local.reference) | ||
|
||
(function_call name: (identifier) @local.reference) | ||
|
||
(dependency name: (identifier) @local.reference) | ||
|
||
(dependency_expression name: (identifier) @local.reference) | ||
|
||
(value (identifier) @local.reference) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
; File autogenerated by build-queries-nvim.py; do not edit | ||
|
||
(recipe | ||
(recipe_body) @function.inside) @function.around | ||
|
||
(parameters | ||
((_) @parameter.inside . ","? @parameter.around)) @parameter.around | ||
|
||
(dependency_expression | ||
(_) @parameter.inside) @parameter.around | ||
|
||
(function_call | ||
arguments: (sequence (expression) @parameter.inside) @parameter.around) @function.around | ||
|
||
(comment) @comment.around |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
; File autogenerated by build-queries-nvim.py; do not edit | ||
|
||
; Define collapse points | ||
|
||
[ | ||
(recipe) | ||
(string) | ||
(external_command) | ||
] @fold | ||
(#trim! @fold) |
Oops, something went wrong.