mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 01:16:18 +04:00
Add standalone language support for just
(#6453)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
This commit is contained in:
parent
896404c7ea
commit
4cdba7cccd
@ -72,6 +72,7 @@
|
||||
| jsonnet | ✓ | | | `jsonnet-language-server` |
|
||||
| jsx | ✓ | ✓ | ✓ | `typescript-language-server` |
|
||||
| julia | ✓ | ✓ | ✓ | `julia` |
|
||||
| just | ✓ | ✓ | ✓ | |
|
||||
| kdl | ✓ | | | |
|
||||
| kotlin | ✓ | | | `kotlin-language-server` |
|
||||
| latex | ✓ | ✓ | | `texlab` |
|
||||
|
@ -978,8 +978,8 @@ source = { git = "https://github.com/uyha/tree-sitter-cmake", rev = "6e51463ef30
|
||||
[[language]]
|
||||
name = "make"
|
||||
scope = "source.make"
|
||||
file-types = ["Makefile", "makefile", "mk", "Justfile", "justfile", ".justfile"]
|
||||
injection-regex = "(make|makefile|Makefile|mk|just)"
|
||||
file-types = ["Makefile", "makefile", "mk"]
|
||||
injection-regex = "(make|makefile|Makefile|mk)"
|
||||
roots = []
|
||||
comment-token = "#"
|
||||
indent = { tab-width = 4, unit = "\t" }
|
||||
@ -2505,3 +2505,16 @@ language-server = { command = "clangd" }
|
||||
[[grammar]]
|
||||
name = "opencl"
|
||||
source = { git = "https://github.com/lefp/tree-sitter-opencl", rev = "8e1d24a57066b3cd1bb9685bbc1ca9de5c1b78fb" }
|
||||
|
||||
[[language]]
|
||||
name = "just"
|
||||
scope = "source.just"
|
||||
file-types = ["justfile", "Justfile", "just"]
|
||||
injection-regex = "just"
|
||||
roots = []
|
||||
comment-token = "#"
|
||||
indent = { tab-width = 4, unit = "\t" }
|
||||
|
||||
[[grammar]]
|
||||
name = "just"
|
||||
source = { git = "https://github.com/IndianBoy42/tree-sitter-just", rev = "8af0aab79854aaf25b620a52c39485849922f766" }
|
||||
|
4
runtime/queries/just/folds.scm
Normal file
4
runtime/queries/just/folds.scm
Normal file
@ -0,0 +1,4 @@
|
||||
(body) @fold
|
||||
(recipe) @fold
|
||||
(interpolation) @fold
|
||||
(item (_) @fold)
|
33
runtime/queries/just/highlights.scm
Normal file
33
runtime/queries/just/highlights.scm
Normal file
@ -0,0 +1,33 @@
|
||||
(assignment (NAME) @variable)
|
||||
(alias (NAME) @variable)
|
||||
(value (NAME) @variable)
|
||||
(parameter (NAME) @variable)
|
||||
(setting (NAME) @keyword)
|
||||
(setting "shell" @keyword)
|
||||
|
||||
(call (NAME) @function)
|
||||
(dependency (NAME) @function)
|
||||
(depcall (NAME) @function)
|
||||
(recipeheader (NAME) @function)
|
||||
|
||||
(depcall (expression) @variable.parameter)
|
||||
(parameter) @variable.parameter
|
||||
(variadic_parameters) @variable.parameter
|
||||
|
||||
["if" "else"] @keyword.control.conditional
|
||||
|
||||
(string) @string
|
||||
|
||||
(boolean ["true" "false"]) @constant.builtin.boolean
|
||||
|
||||
(comment) @comment
|
||||
|
||||
; (interpolation) @string
|
||||
|
||||
(shebang interpreter:(TEXT) @keyword ) @comment
|
||||
|
||||
["export" "alias" "set"] @keyword
|
||||
|
||||
["@" "==" "!=" "+" ":="] @operator
|
||||
|
||||
[ "(" ")" "[" "]" "{{" "}}" "{" "}"] @punctuation.bracket
|
3
runtime/queries/just/indents.scm
Normal file
3
runtime/queries/just/indents.scm
Normal file
@ -0,0 +1,3 @@
|
||||
[
|
||||
(recipe_body)
|
||||
] @indent
|
16
runtime/queries/just/injections.scm
Normal file
16
runtime/queries/just/injections.scm
Normal file
@ -0,0 +1,16 @@
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
(shebang_recipe
|
||||
(shebang
|
||||
interpreter:(TEXT) @injection.language)
|
||||
(shebang_body) @injection.content
|
||||
)
|
||||
|
||||
(source_file
|
||||
(item (setting lang:(NAME) @injection.language))
|
||||
(item (recipe (body (recipe_body) @injection.content)))
|
||||
)
|
||||
|
||||
; ((interpolation (expression) @injection.content)
|
||||
; (#set! injection.language "just"))
|
10
runtime/queries/just/locals.scm
Normal file
10
runtime/queries/just/locals.scm
Normal file
@ -0,0 +1,10 @@
|
||||
(assignment (NAME) @local.definition)
|
||||
(alias left:(NAME) @local.definition)
|
||||
(alias right:(NAME) @local.reference)
|
||||
(value (NAME) @local.reference)
|
||||
(parameter (NAME) @local.definition)
|
||||
|
||||
(call (NAME) @local.reference)
|
||||
(dependency (NAME) @local.reference)
|
||||
(depcall (NAME) @local.reference)
|
||||
(recipeheader (NAME) @local.definition)
|
48
runtime/queries/just/textobjects.scm
Normal file
48
runtime/queries/just/textobjects.scm
Normal file
@ -0,0 +1,48 @@
|
||||
(body) @function.inside
|
||||
(recipe) @function.around
|
||||
(expression
|
||||
if:(expression) @function.inside
|
||||
)
|
||||
(expression
|
||||
else:(expression) @function.inside
|
||||
)
|
||||
(interpolation (expression) @function.inside) @function.around
|
||||
(settinglist (stringlist) @function.inside) @function.around
|
||||
|
||||
(call (NAME) @class.inside) @class.around
|
||||
(dependency (NAME) @class.inside) @class.around
|
||||
(depcall (NAME) @class.inside)
|
||||
|
||||
(dependency) @parameter.around
|
||||
(depcall) @parameter.inside
|
||||
(depcall (expression) @parameter.inside)
|
||||
|
||||
(stringlist
|
||||
(string) @parameter.inside
|
||||
. ","? @_end
|
||||
; Commented out since we don't support `#make-range!` at the moment
|
||||
; (#make-range! "parameter.around" @parameter.inside @_end)
|
||||
)
|
||||
(parameters
|
||||
[(parameter)
|
||||
(variadic_parameters)] @parameter.inside
|
||||
. " "? @_end
|
||||
; Commented out since we don't support `#make-range!` at the moment
|
||||
; (#make-range! "parameter.around" @parameter.inside @_end)
|
||||
)
|
||||
|
||||
(expression
|
||||
(condition) @function.inside
|
||||
) @function.around
|
||||
(expression
|
||||
if:(expression) @function.inside
|
||||
)
|
||||
(expression
|
||||
else:(expression) @function.inside
|
||||
)
|
||||
|
||||
(item [(alias) (assignment) (export) (setting)]) @class.around
|
||||
(recipeheader) @class.around
|
||||
(line) @class.around
|
||||
|
||||
(comment) @comment.around
|
Loading…
Reference in New Issue
Block a user