-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Queries based on the neovims ones: https://github.com/nvim-treesitter/nvim-treesitter/tree/master/queries/hcl and modified for helix support. There are a few snippets that I did not know how to port across and are commented out.
- Loading branch information
Showing
8 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
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
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
Submodule tree-sitter-hcl
added at
3cb7fc
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
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,6 @@ | ||
[ | ||
(comment) | ||
(block) | ||
(heredoc_template) | ||
(object) | ||
] @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,100 @@ | ||
(ERROR) @error | ||
|
||
; { key: val } | ||
|
||
;(object_elem val: (expression | ||
; (variable_expr | ||
; (identifier) @type.builtin (#match? @type.builtin "^(bool|string|number|object|tuple|list|map|set|any)$")))) | ||
|
||
(get_attr (identifier) @variable.builtin (#match? @variable.builtin "^(root|cwd|module)$")) | ||
(variable_expr (identifier) @variable.builtin (#match? @variable.builtin "^(var|local|path)$")) | ||
((identifier) @type.builtin (#match? @type.builtin "^(bool|string|number|object|tuple|list|map|set|any)$")) | ||
((identifier) @keyword (#match? @keyword "^(module|root|cwd|resource|variable|data|locals|terraform|provider|output)$")) | ||
|
||
; highlight identifier keys as though they were block attributes | ||
;(object_elem key: (expression (variable_expr (identifier) @field))) | ||
|
||
(attribute (identifier) @variable.other.member) | ||
(function_call (identifier) @function.method) | ||
(block (identifier) @type.builtin) | ||
|
||
(identifier) @variable | ||
(comment) @comment | ||
(null) @constant.builtin | ||
(numeric_literal) @constant.number | ||
|
||
[ | ||
(true) | ||
(false) | ||
] @constant.builtin.boolean | ||
|
||
;[ | ||
; (template_interpolation_start) ; ${ | ||
; (template_interpolation_end) ; } | ||
; (template_directive_start) ; %{ | ||
; (template_directive_end) ; } | ||
; (strip_marker) ; ~ | ||
;] @punctuation.special | ||
|
||
;[ | ||
; (heredoc_identifier) ; <<END | ||
; (heredoc_start) ; END | ||
;] @punctuation.delimiter | ||
|
||
[ | ||
"if" | ||
(conditional) | ||
] @conditional | ||
|
||
[ | ||
"for" | ||
"in" | ||
] @repeat | ||
|
||
[ | ||
":" | ||
"=" | ||
] @none | ||
|
||
[ | ||
"?" | ||
"=>" | ||
] @punctuation.special | ||
|
||
[ | ||
"." | ||
"," | ||
] @punctuation.delimiter | ||
|
||
[ | ||
"{" | ||
"}" | ||
"[" | ||
"]" | ||
"(" | ||
")" | ||
] @punctuation.bracket | ||
|
||
[ | ||
"!" | ||
"\*" | ||
"/" | ||
"%" | ||
"\+" | ||
"-" | ||
">" | ||
">=" | ||
"<" | ||
"<=" | ||
"==" | ||
"!=" | ||
"&&" | ||
"||" | ||
] @operator | ||
|
||
[ | ||
(string_literal) | ||
(quoted_template) | ||
] @string | ||
|
||
(escape_sequence) @punctuation.special |
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,13 @@ | ||
indent = [ | ||
"object", | ||
"block", | ||
"tuple", | ||
"for_tuple_expr", | ||
"for_object_expr" | ||
] | ||
|
||
outdent = [ | ||
"object_end", | ||
"block_end", | ||
"tuple_end" | ||
] |
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,2 @@ | ||
((comment) @injection.content | ||
(#set! injection.language "comment")) |