From bd2f28ff8122a60cc3269065803462278b7cca90 Mon Sep 17 00:00:00 2001 From: Sam Rolfe Date: Mon, 9 Feb 2026 16:59:23 +1100 Subject: [PATCH] Fix treesitter config module name for current nvim-treesitter --- home/sam/nvim/lua/sam/plugins/treesitter.lua | 28 ++++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/home/sam/nvim/lua/sam/plugins/treesitter.lua b/home/sam/nvim/lua/sam/plugins/treesitter.lua index da46026..55b56fd 100755 --- a/home/sam/nvim/lua/sam/plugins/treesitter.lua +++ b/home/sam/nvim/lua/sam/plugins/treesitter.lua @@ -3,9 +3,21 @@ return { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", -- Installs and updates parsers - config = function() - require("nvim-treesitter.configs").setup({ - -- A list of parser names, or "all" + +config = function() + local ok, ts = pcall(require, "nvim-treesitter.config") + if not ok then + ok, ts = pcall(require, "nvim-treesitter.configs") + end + if not ok then + vim.notify( + "nvim-treesitter: config module not found", + vim.log.levels.ERROR + ) + return + end + + ts.setup({ ensure_installed = { "c", "cpp", @@ -21,16 +33,10 @@ return { "json", "php", }, - - -- Install parsers synchronously (only applied on startup) sync_install = false, - - -- Automatically install missing parsers when entering buffer auto_install = true, - - highlight = { - enable = true, - }, + highlight = { enable = true }, }) end, + }