diff options
| author | mhoffm <mhoffm@posteo.de> | 2021-06-28 19:11:33 +0200 |
|---|---|---|
| committer | Stephan Seitz <stephan.lauf@yahoo.de> | 2021-07-02 01:56:25 +0200 |
| commit | 9275a15aadc6a429af23fd82245fea5ed2799e71 (patch) | |
| tree | 8a372bb91904cf5e28f7bb3617f2fd1f5502860e | |
| parent | python(highlights): don't use type for APP (diff) | |
| download | nvim-treesitter-9275a15aadc6a429af23fd82245fea5ed2799e71.tar nvim-treesitter-9275a15aadc6a429af23fd82245fea5ed2799e71.tar.gz nvim-treesitter-9275a15aadc6a429af23fd82245fea5ed2799e71.tar.bz2 nvim-treesitter-9275a15aadc6a429af23fd82245fea5ed2799e71.tar.lz nvim-treesitter-9275a15aadc6a429af23fd82245fea5ed2799e71.tar.xz nvim-treesitter-9275a15aadc6a429af23fd82245fea5ed2799e71.tar.zst nvim-treesitter-9275a15aadc6a429af23fd82245fea5ed2799e71.zip | |
add hcl parser
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | lockfile.json | 3 | ||||
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 10 | ||||
| -rw-r--r-- | queries/hcl/folds.scm | 5 | ||||
| -rw-r--r-- | queries/hcl/highlights.scm | 72 |
5 files changed, 91 insertions, 0 deletions
@@ -161,6 +161,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [gomod](https://github.com/camdencheek/tree-sitter-go-mod) (maintained by @camdencheek) - [x] [graphql](https://github.com/bkegley/tree-sitter-graphql) (maintained by @bkegley) - [ ] [haskell](https://github.com/tree-sitter/tree-sitter-haskell) +- [x] [hcl](https://github.com/MichaHoffmann/tree-sitter-hcl) (maintained by @MichaHoffmann) - [x] [html](https://github.com/tree-sitter/tree-sitter-html) (maintained by @TravonteD) - [x] [java](https://github.com/tree-sitter/tree-sitter-java) (maintained by @p00f) - [x] [javascript](https://github.com/tree-sitter/tree-sitter-javascript) (maintained by @steelsojka) diff --git a/lockfile.json b/lockfile.json index 7ddc6ed5e..926200b6e 100644 --- a/lockfile.json +++ b/lockfile.json @@ -77,6 +77,9 @@ "haskell": { "revision": "a0c1adb59e390f7d839a146c57fdb33d36ed97e6" }, + "hcl": { + "revision": "7d8ecd053a11274a15b0aa1d1e82f37e64edeb42" + }, "html": { "revision": "d93af487cc75120c89257195e6be46c999c6ba18" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 0d1cedee3..2e4ff1c63 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -348,6 +348,16 @@ list.haskell = { } } +list.hcl = { + install_info = { + url = "https://github.com/MichaHoffmann/tree-sitter-hcl", + files = {"src/parser.c", "src/scanner.cc"}, + branch = "main" + }, + filetype = "hcl", + used_by = {"tf", "tfvars"} +} + -- FIXME(vigoux): markdown is broken for now -- list.markdown = { -- install_info = { diff --git a/queries/hcl/folds.scm b/queries/hcl/folds.scm new file mode 100644 index 000000000..8349f4f91 --- /dev/null +++ b/queries/hcl/folds.scm @@ -0,0 +1,5 @@ +[ + (comment) + (block) + (heredoc_template) +] @fold diff --git a/queries/hcl/highlights.scm b/queries/hcl/highlights.scm new file mode 100644 index 000000000..135351ac3 --- /dev/null +++ b/queries/hcl/highlights.scm @@ -0,0 +1,72 @@ +; highlights.scm + +[ + "!" + "\*" + "/" + "%" + "\+" + "-" + ">" + ">=" + "<" + "<=" + "==" + "!=" + "&&" + "||" +] @operator + +[ + "{" + "}" + "[" + "]" + "(" + ")" + "[*]" + ".*" +] @specialChar + +[ + "." + "," +] @specialChar + +[ + (ellipsis) + "\?" + ":" + "=>" +] @special + +[ + "for" + "in" +] @repeat + +[ + "if" +] @conditional + +[ + (string_lit) + (quoted_template) + (heredoc_template) +] @string + +(heredoc_identifier) @namespace +(heredoc_start) @namespace +(template_interpolation) @statement +(numeric_lit) @number +(bool_lit) @boolean +(null_lit) @constant +(comment) @comment +(identifier) @identifier + +(block (identifier) @namespace) +(function_call (identifier) @function) +(function_call (function_arguments) @parameter) +(attribute (identifier) @symbol) + +(ERROR) @error |
