diff options
| author | Michael Hoffmann <mhoffm@posteo.de> | 2022-12-02 23:47:19 +0100 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2022-12-29 22:18:41 +0100 |
| commit | ee3e9f4dc0e5ee9e2bfb1ee47638375840b8fe0f (patch) | |
| tree | f638bb4493056146317796d894464801b805118b /queries/hcl | |
| parent | Update parsers: astro, ocaml, ocaml_interface (diff) | |
| download | nvim-treesitter-ee3e9f4dc0e5ee9e2bfb1ee47638375840b8fe0f.tar nvim-treesitter-ee3e9f4dc0e5ee9e2bfb1ee47638375840b8fe0f.tar.gz nvim-treesitter-ee3e9f4dc0e5ee9e2bfb1ee47638375840b8fe0f.tar.bz2 nvim-treesitter-ee3e9f4dc0e5ee9e2bfb1ee47638375840b8fe0f.tar.lz nvim-treesitter-ee3e9f4dc0e5ee9e2bfb1ee47638375840b8fe0f.tar.xz nvim-treesitter-ee3e9f4dc0e5ee9e2bfb1ee47638375840b8fe0f.tar.zst nvim-treesitter-ee3e9f4dc0e5ee9e2bfb1ee47638375840b8fe0f.zip | |
feat(hcl,terraform): split terraform from hcl, add specialized queries for tf
This enables us to have different queries for
terraform and general hcl. It solve the situation
where other dialects of hcl (nomad, packer, etc)
might use a terraform keyword and get highlighted
out of place.
Diffstat (limited to 'queries/hcl')
| -rw-r--r-- | queries/hcl/highlights.scm | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/queries/hcl/highlights.scm b/queries/hcl/highlights.scm index 658369292..4f2eb2300 100644 --- a/queries/hcl/highlights.scm +++ b/queries/hcl/highlights.scm @@ -81,7 +81,8 @@ (comment) @comment @spell (identifier) @variable -(block (identifier) @type) +(body (block (identifier) @keyword)) +(body (block (body (block (identifier) @type)))) (function_call (identifier) @function) (attribute (identifier) @field) @@ -90,13 +91,9 @@ ; highlight identifier keys as though they were block attributes (object_elem key: (expression (variable_expr (identifier) @field))) -((identifier) @keyword (#any-of? @keyword "module" "root" "cwd" "resource" "variable" "data" "locals" "terraform" "provider" "output")) -((identifier) @type.builtin (#any-of? @type.builtin "bool" "string" "number" "object" "tuple" "list" "map" "set" "any")) -(variable_expr (identifier) @variable.builtin (#any-of? @variable.builtin "var" "local" "path")) -(get_attr (identifier) @variable.builtin (#any-of? @variable.builtin "root" "cwd" "module")) - -(object_elem val: (expression - (variable_expr - (identifier) @type.builtin (#any-of? @type.builtin "bool" "string" "number" "object" "tuple" "list" "map" "set" "any")))) +; var.foo, data.bar +; +; first element in get_attr is a keyword or a reference to a keyword +(expression (variable_expr (identifier) @keyword) (get_attr (identifier) @field)) (ERROR) @error |
