File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11-- a list of filetypes to install treesitter parsers and queries
2+ local nvim_treesitter = require (" nvim-treesitter" )
3+
24local 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 )
You can’t perform that action at this time.
0 commit comments