Skip to content

Commit edaceec

Browse files
VuiMuichthe-mikedavis
authored and
Schuyler Mortimer
committedJul 10, 2024
Add standalone language support for just (helix-editor#6453)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
1 parent 524852b commit edaceec

File tree

8 files changed

+130
-2
lines changed

8 files changed

+130
-2
lines changed
 

‎book/src/generated/lang-support.md

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
| jsonnet || | | `jsonnet-language-server` |
7373
| jsx |||| `typescript-language-server` |
7474
| julia |||| `julia` |
75+
| just |||| |
7576
| kdl || | | |
7677
| kotlin || | | `kotlin-language-server` |
7778
| latex ||| | `texlab` |

‎languages.toml

+15-2
Original file line numberDiff line numberDiff line change
@@ -978,8 +978,8 @@ source = { git = "https://github.com/uyha/tree-sitter-cmake", rev = "6e51463ef30
978978
[[language]]
979979
name = "make"
980980
scope = "source.make"
981-
file-types = ["Makefile", "makefile", "mk", "Justfile", "justfile", ".justfile"]
982-
injection-regex = "(make|makefile|Makefile|mk|just)"
981+
file-types = ["Makefile", "makefile", "mk"]
982+
injection-regex = "(make|makefile|Makefile|mk)"
983983
roots = []
984984
comment-token = "#"
985985
indent = { tab-width = 4, unit = "\t" }
@@ -2505,3 +2505,16 @@ language-server = { command = "clangd" }
25052505
[[grammar]]
25062506
name = "opencl"
25072507
source = { git = "https://github.com/lefp/tree-sitter-opencl", rev = "8e1d24a57066b3cd1bb9685bbc1ca9de5c1b78fb" }
2508+
2509+
[[language]]
2510+
name = "just"
2511+
scope = "source.just"
2512+
file-types = ["justfile", "Justfile", "just"]
2513+
injection-regex = "just"
2514+
roots = []
2515+
comment-token = "#"
2516+
indent = { tab-width = 4, unit = "\t" }
2517+
2518+
[[grammar]]
2519+
name = "just"
2520+
source = { git = "https://github.com/IndianBoy42/tree-sitter-just", rev = "8af0aab79854aaf25b620a52c39485849922f766" }

‎runtime/queries/just/folds.scm

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
(body) @fold
2+
(recipe) @fold
3+
(interpolation) @fold
4+
(item (_) @fold)

‎runtime/queries/just/highlights.scm

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
(assignment (NAME) @variable)
2+
(alias (NAME) @variable)
3+
(value (NAME) @variable)
4+
(parameter (NAME) @variable)
5+
(setting (NAME) @keyword)
6+
(setting "shell" @keyword)
7+
8+
(call (NAME) @function)
9+
(dependency (NAME) @function)
10+
(depcall (NAME) @function)
11+
(recipeheader (NAME) @function)
12+
13+
(depcall (expression) @variable.parameter)
14+
(parameter) @variable.parameter
15+
(variadic_parameters) @variable.parameter
16+
17+
["if" "else"] @keyword.control.conditional
18+
19+
(string) @string
20+
21+
(boolean ["true" "false"]) @constant.builtin.boolean
22+
23+
(comment) @comment
24+
25+
; (interpolation) @string
26+
27+
(shebang interpreter:(TEXT) @keyword ) @comment
28+
29+
["export" "alias" "set"] @keyword
30+
31+
["@" "==" "!=" "+" ":="] @operator
32+
33+
[ "(" ")" "[" "]" "{{" "}}" "{" "}"] @punctuation.bracket

‎runtime/queries/just/indents.scm

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[
2+
(recipe_body)
3+
] @indent

‎runtime/queries/just/injections.scm

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
((comment) @injection.content
2+
(#set! injection.language "comment"))
3+
4+
(shebang_recipe
5+
(shebang
6+
interpreter:(TEXT) @injection.language)
7+
(shebang_body) @injection.content
8+
)
9+
10+
(source_file
11+
(item (setting lang:(NAME) @injection.language))
12+
(item (recipe (body (recipe_body) @injection.content)))
13+
)
14+
15+
; ((interpolation (expression) @injection.content)
16+
; (#set! injection.language "just"))

‎runtime/queries/just/locals.scm

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
(assignment (NAME) @local.definition)
2+
(alias left:(NAME) @local.definition)
3+
(alias right:(NAME) @local.reference)
4+
(value (NAME) @local.reference)
5+
(parameter (NAME) @local.definition)
6+
7+
(call (NAME) @local.reference)
8+
(dependency (NAME) @local.reference)
9+
(depcall (NAME) @local.reference)
10+
(recipeheader (NAME) @local.definition)

‎runtime/queries/just/textobjects.scm

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
(body) @function.inside
2+
(recipe) @function.around
3+
(expression
4+
if:(expression) @function.inside
5+
)
6+
(expression
7+
else:(expression) @function.inside
8+
)
9+
(interpolation (expression) @function.inside) @function.around
10+
(settinglist (stringlist) @function.inside) @function.around
11+
12+
(call (NAME) @class.inside) @class.around
13+
(dependency (NAME) @class.inside) @class.around
14+
(depcall (NAME) @class.inside)
15+
16+
(dependency) @parameter.around
17+
(depcall) @parameter.inside
18+
(depcall (expression) @parameter.inside)
19+
20+
(stringlist
21+
(string) @parameter.inside
22+
. ","? @_end
23+
; Commented out since we don't support `#make-range!` at the moment
24+
; (#make-range! "parameter.around" @parameter.inside @_end)
25+
)
26+
(parameters
27+
[(parameter)
28+
(variadic_parameters)] @parameter.inside
29+
. " "? @_end
30+
; Commented out since we don't support `#make-range!` at the moment
31+
; (#make-range! "parameter.around" @parameter.inside @_end)
32+
)
33+
34+
(expression
35+
(condition) @function.inside
36+
) @function.around
37+
(expression
38+
if:(expression) @function.inside
39+
)
40+
(expression
41+
else:(expression) @function.inside
42+
)
43+
44+
(item [(alias) (assignment) (export) (setting)]) @class.around
45+
(recipeheader) @class.around
46+
(line) @class.around
47+
48+
(comment) @comment.around

0 commit comments

Comments
 (0)
Please sign in to comment.