2025-10-06 16:51:08 -06:00
|
|
|
HCL and Terraform parsers that treat `{%` as comment lines for... reasons. iykyk 🤷
|
|
|
|
|
|
|
|
|
|
# Neovim usage with the `nvim-treesitter` plugin
|
|
|
|
|
|
2025-10-07 15:46:56 +00:00
|
|
|
Clone this repo somewhere then add this to your config:
|
|
|
|
|
|
2025-10-06 16:51:08 -06:00
|
|
|
```lua
|
|
|
|
|
local configs = require("nvim-treesitter.configs")
|
|
|
|
|
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
|
|
|
|
|
|
2025-10-07 15:46:56 +00:00
|
|
|
-- for some reason you can't use the repo url here. it won't override the
|
|
|
|
|
-- default tf and hcl parsers.
|
|
|
|
|
local jhcl_repo = "~/path/to/this/repo"
|
2025-10-06 16:51:08 -06:00
|
|
|
|
|
|
|
|
parser_config.hcl = {
|
|
|
|
|
install_info = {
|
|
|
|
|
url = jhcl_repo,
|
|
|
|
|
files = { "src/parser.c", "src/scanner.c" },
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
parser_config.terraform = {
|
|
|
|
|
install_info = {
|
|
|
|
|
url = jhcl_repo,
|
|
|
|
|
files = { "src/parser.c", "src/scanner.c" },
|
|
|
|
|
location = "dialects/terraform",
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
configs.setup({
|
|
|
|
|
-- ...
|
|
|
|
|
|
|
|
|
|
-- We overwrote the default `nvim-treesitter` configs for `hcl` and
|
|
|
|
|
-- `terraform` above, so we can include them in `ensure_installed` normally
|
|
|
|
|
ensure_installed = {
|
|
|
|
|
-- ...
|
|
|
|
|
"hcl",
|
|
|
|
|
"terraform",
|
|
|
|
|
-- ...
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
-- ...
|
|
|
|
|
})
|
2021-06-19 16:56:35 +02:00
|
|
|
```
|