Closed cova-fe closed 2 years ago
Hey @cova-fe,
This parser should already be installed as "hcl": https://github.com/nvim-treesitter/nvim-treesitter/blob/fa2a6b68aaa6df0187b5bbebe6cbadc120d4a65a/lua/nvim-treesitter/parsers.lua#L435. The used_by: "terraform"
should make it work with terraform and there are also a few autocommands to set the filetype of .tf
and .tfvars
to "terraform" so that the parser is chosen for files with that ending: https://github.com/nvim-treesitter/nvim-treesitter/blob/fa2a6b68aaa6df0187b5bbebe6cbadc120d4a65a/ftdetect/hcl.vim#L2
In principle it should work out of the box with just TSInstall hcl
i think! Does this help you?
ps.: i think the error comes from the fact that this parser exports the symbol tree_sitter_hcl
instead of tree_sitter_terraform
( https://github.com/MichaHoffmann/tree-sitter-hcl/blob/3cb7fc28247efbcb2973b97e71c78838ad98a583/src/parser.c#L31372 )
Yep, indeed! I was tricked because I was searching for "terraform" in the list of supported files :) sorry for the noise and thanks for the quick answer!
Hey @cova-fe,
no worries, the setup is a little confusing with hcl
vs terraform
, actually i think one could probably write a terraform parser ( adding the missing keywords ) using this as a base and make highlighting and everything a little more comfortable in nvim-treesitter. Maybe in a future version!
Describe the bug Hi, I'm trying to install this parser, using https://github.com/nvim-treesitter/nvim-treesitter#adding-parsers directions. The installation seems to be ok, but I get this error when opening a terraform file:
To Reproduce I just followed the directions described above. My configuration for this plugin:
Then I just ran
TSInstall terraform
(also tried from grammar)I'm pretty sure that I'm doing something wrong, but can't see what :) I'm running lunarvim (master) with neovim 0.6.1
Any suggestions where to look?
Thanks!