File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -54,9 +54,18 @@ if vim.on_key then
5454end
5555
5656-- see compare.scopes
57- if vim .fn .has (' nvim-0.9' ) then
57+ if vim .fn .has (' nvim-0.9' ) == 1 then
58+ local ts = vim .treesitter
59+ local has_ts_parser = ts .language .get_lang
60+ -- vim.treesitter.language.add is recommended for checking treesitter in 0.11 nightly
61+ if vim .fn .has (' nvim-0.11' ) then
62+ has_ts_parser = function (filetype )
63+ local lang = ts .language .get_lang (filetype )
64+ return lang and ts .language .add (lang )
65+ end
66+ end
5867 autocmd .subscribe ({ ' FileType' }, function (details )
59- if vim . treesitter . language . get_lang (details .match ) then
68+ if has_ts_parser (details .match ) then
6069 vim .b [details .buf ].cmp_buf_has_ts_parser = true
6170 else
6271 vim .b [details .buf ].cmp_buf_has_ts_parser = false
You can’t perform that action at this time.
0 commit comments