From cabf2be26697ba71ae7260db30e65aaae54790c6 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 29 Sep 2024 15:36:23 +0200 Subject: [PATCH] fix(treesitter): adapt to upstream change In Nvim 0.11, `vim.treesitter.language.add()` returns `true` on success or `nil,errmsg` on failure instead of throwing an error. --- lua/telescope/utils.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/telescope/utils.lua b/lua/telescope/utils.lua index 44ab5d9b08..145b7f3aae 100644 --- a/lua/telescope/utils.lua +++ b/lua/telescope/utils.lua @@ -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