From 38216e6701a63e403e735896b558d6cbb1d0c1ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Ol=C3=B3rtegui?= <20072509+olrtg@users.noreply.github.com> Date: Tue, 14 May 2024 03:37:33 -0400 Subject: [PATCH] fix: handle context-commentstring setup (#4451) --- lua/lvim/core/treesitter.lua | 14 ++++++++++++-- snapshots/default.json | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lua/lvim/core/treesitter.lua b/lua/lvim/core/treesitter.lua index 59a16279..bdb127c0 100644 --- a/lua/lvim/core/treesitter.lua +++ b/lua/lvim/core/treesitter.lua @@ -102,14 +102,24 @@ function M.setup() return end - local status_ok, treesitter_configs = pcall(require, "nvim-treesitter.configs") - if not status_ok then + local ts_status_ok, treesitter_configs = pcall(require, "nvim-treesitter.configs") + if not ts_status_ok then Log:error "Failed to load nvim-treesitter.configs" return end + local status_ok, ts_context_commentstring = pcall(require, "ts_context_commentstring") + if not status_ok then + Log:error "Failed to load ts_context_commentstring" + return + end + local opts = vim.deepcopy(lvim.builtin.treesitter) + -- handle deprecated API, https://github.com/JoosepAlviste/nvim-ts-context-commentstring/issues/82 + ts_context_commentstring.setup(opts.context_commentstring) + opts.context_commentstring = nil + treesitter_configs.setup(opts) if lvim.builtin.treesitter.on_config_done then diff --git a/snapshots/default.json b/snapshots/default.json index 8633f90f..e1f6a878 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -87,10 +87,10 @@ "commit": "64f61e4" }, "nvim-treesitter": { - "commit": "1e64838" + "commit": "d5a1c2b" }, "nvim-ts-context-commentstring": { - "commit": "b8ff464" + "commit": "0bdccb9" }, "nvim-web-devicons": { "commit": "5b90678"