Skip to content

Commit 71f4f49

Browse files
committed
update treesitter config
1 parent db61060 commit 71f4f49

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

lua/config/treesitter.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
-- a list of filetypes to install treesitter parsers and queries
2+
local nvim_treesitter = require("nvim-treesitter")
3+
24
local ensure_installed = {
35
"cpp",
46
"diff",
57
"go",
8+
"gomod",
9+
"gosum",
610
"javascript",
711
"json",
812
"lua",
@@ -27,13 +31,14 @@ vim.api.nvim_create_autocmd("FileType", {
2731
end
2832

2933
-- check if parser is available
30-
if not vim.treesitter.language.add(lang) then
31-
local available = vim.g.ts_available or require("nvim-treesitter").get_available()
34+
local is_parser_available = vim.treesitter.language.add(lang)
35+
if not is_parser_available then
36+
local available_langs = vim.g.ts_available or nvim_treesitter.get_available()
3237
if not vim.g.ts_available then
33-
vim.g.ts_available = available
38+
vim.g.ts_available = available_langs
3439
end
3540

36-
if vim.tbl_contains(available, lang) then
41+
if vim.tbl_contains(available_langs, lang) then
3742
-- install treesitter parsers and queries
3843
local install_msg = string.format("Installing parsers and queries for %s", lang)
3944
vim.print(install_msg)

0 commit comments

Comments
 (0)