We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent be8b111 commit 51da174Copy full SHA for 51da174
plugin/cmp.lua
@@ -54,9 +54,18 @@ if vim.on_key then
54
end
55
56
-- see compare.scopes
57
-if vim.fn.has('nvim-0.9') then
+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
67
autocmd.subscribe({ 'FileType' }, function(details)
- if vim.treesitter.language.get_lang(details.match) then
68
+ if has_ts_parser(details.match) then
69
vim.b[details.buf].cmp_buf_has_ts_parser = true
70
else
71
vim.b[details.buf].cmp_buf_has_ts_parser = false
0 commit comments