Skip to content

Commit

Permalink
fix(treesitter): adapt to upstream change
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 committed Sep 29, 2024
1 parent cb3f98d commit cabf2be
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 cabf2be

Please sign in to comment.