fix(treesitter): adapt to upstream change (#3308)
In Nvim 0.11, `vim.treesitter.language.add()` returns `true` on success or `nil,errmsg` on failure instead of throwing an error.
This commit is contained in:
@@ -662,7 +662,11 @@ end)
|
|||||||
--- Checks if treesitter parser for language is installed
|
--- Checks if treesitter parser for language is installed
|
||||||
---@param lang string
|
---@param lang string
|
||||||
utils.has_ts_parser = function(lang)
|
utils.has_ts_parser = function(lang)
|
||||||
return pcall(vim.treesitter.language.add, lang)
|
if vim.fn.has "nvim-0.11" == 1 then
|
||||||
|
return vim.treesitter.language.add(lang)
|
||||||
|
else
|
||||||
|
return pcall(vim.treesitter.language.add, lang)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Telescope Wrapper around vim.notify
|
--- Telescope Wrapper around vim.notify
|
||||||
|
|||||||
Reference in New Issue
Block a user