Skip to content

Commit

Permalink
fix(treesitter): adapt to upstream change (#3308)
Browse files Browse the repository at this point in the history
In Nvim 0.11, `vim.treesitter.language.add()` returns `true` on success
or `nil,errmsg` on failure instead of throwing an error.
  • Loading branch information
clason authored Sep 30, 2024
1 parent cb3f98d commit eae0d8f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/telescope/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,11 @@ end)
--- Checks if treesitter parser for language is installed
---@param lang string
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

--- Telescope Wrapper around vim.notify
Expand Down

0 comments on commit eae0d8f

Please sign in to comment.