From 5b5be03c861dbe879797459ba56e23467fba59c7 Mon Sep 17 00:00:00 2001 From: Meisterlala <6453306+Meisterlala@users.noreply.github.com> Date: Tue, 7 Jul 2026 14:57:39 +0200 Subject: [PATCH] fix(treesitter): update nvim-treesitter references to neovim-treesitter in plugins corrected plugin references for consistency and compatibility with latest changes in the repository. --- lua/plugins/mini.lua | 16 ++++++---------- lua/plugins/neotest.lua | 2 +- lua/plugins/ng.lua | 12 ++++-------- lua/plugins/nvim-treesitter.lua | 19 +++++++++++++++---- lua/plugins/render-markdown.lua | 2 +- lua/plugins/telescope.lua | 2 +- 6 files changed, 28 insertions(+), 25 deletions(-) diff --git a/lua/plugins/mini.lua b/lua/plugins/mini.lua index d242f29..9eec7b1 100644 --- a/lua/plugins/mini.lua +++ b/lua/plugins/mini.lua @@ -69,16 +69,12 @@ local function my_fileinfo() end -- Get Treesitter language icon (fallback to none if parser missing) - if ft_icon == '' then - local ts_ok, parsers = pcall(require, 'nvim-treesitter.parsers') - if ts_ok then - local ok_lang, lang = pcall(parsers.get_buf_lang, 0) - lang = (ok_lang and lang) or '' - if lang ~= '' and devicons_ok then - local ok_icon, icon = pcall(devicons.get_icon_by_filetype, lang, { default = true }) - if ok_icon and icon then - ft_icon = icon .. ' ' - end + if ft_icon == '' and filetype ~= '' then + local lang = vim.treesitter.language.get_lang(filetype) or '' + if lang ~= '' and devicons_ok then + local ok_icon, icon = pcall(devicons.get_icon_by_filetype, lang, { default = true }) + if ok_icon and icon then + ft_icon = icon .. ' ' end end end diff --git a/lua/plugins/neotest.lua b/lua/plugins/neotest.lua index fe7a404..16d54f9 100644 --- a/lua/plugins/neotest.lua +++ b/lua/plugins/neotest.lua @@ -5,7 +5,7 @@ return { 'nvim-neotest/nvim-nio', 'nvim-lua/plenary.nvim', 'antoinemadec/FixCursorHold.nvim', - 'nvim-treesitter/nvim-treesitter', + 'neovim-treesitter/nvim-treesitter', 'nvim-neotest/neotest-python', }, opts = { diff --git a/lua/plugins/ng.lua b/lua/plugins/ng.lua index fdb90f7..5cda74c 100644 --- a/lua/plugins/ng.lua +++ b/lua/plugins/ng.lua @@ -15,14 +15,10 @@ return { }, } - -- Ensure Treesitter is configured to include Angular - local ok, ts_config = pcall(require, 'nvim-treesitter.configs') - if ok then - local ensure = ts_config.get_module 'ensure_installed' or {} - if type(ensure) == 'table' and not vim.tbl_contains(ensure, 'angular') then - ---@diagnostic disable-next-line: missing-fields - ts_config.setup { ensure_installed = vim.list_extend(ensure, { 'angular' }) } - end + -- Ensure the Angular parser is installed + local ok, ts = pcall(require, 'nvim-treesitter') + if ok and not vim.list_contains(ts.get_installed 'parsers', 'angular') then + pcall(function() ts.install({ 'angular' }):wait(30000) end) end -- Key mappings for Angular navigation diff --git a/lua/plugins/nvim-treesitter.lua b/lua/plugins/nvim-treesitter.lua index b431059..0e74ed8 100644 --- a/lua/plugins/nvim-treesitter.lua +++ b/lua/plugins/nvim-treesitter.lua @@ -1,6 +1,7 @@ --- @type LazySpec | LazySpec[] return { - 'nvim-treesitter/nvim-treesitter', + 'neovim-treesitter/nvim-treesitter', + dependencies = { 'neovim-treesitter/treesitter-parser-registry' }, build = ':TSUpdate', lazy = false, branch = 'main', @@ -9,11 +10,9 @@ return { local install_dir = vim.fn.stdpath 'data' .. '/site' vim.opt.rtp:prepend(install_dir) - -- Setup nvim-treesitter (new main branch uses minimal config) + -- Setup nvim-treesitter require('nvim-treesitter').setup { install_dir = install_dir, - ensure_installed = {}, - auto_install = true, } -- Enable Folding @@ -42,6 +41,18 @@ return { return end + local ft = vim.bo[buf].filetype + if ft == '' then + return + end + + -- auto_install was removed upstream; install the parser ourselves if missing + local ts = require 'nvim-treesitter' + local lang = vim.treesitter.language.get_lang(ft) or ft + if not vim.list_contains(ts.get_installed 'parsers', lang) and vim.list_contains(ts.get_available(), lang) then + pcall(function() ts.install({ lang }):wait(30000) end) + end + -- Enable treesitter highlighting pcall(vim.treesitter.start, buf) end, diff --git a/lua/plugins/render-markdown.lua b/lua/plugins/render-markdown.lua index 8954f08..f9d9984 100644 --- a/lua/plugins/render-markdown.lua +++ b/lua/plugins/render-markdown.lua @@ -1,7 +1,7 @@ --- @type LazySpec return { 'MeanderingProgrammer/render-markdown.nvim', - dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, + dependencies = { 'neovim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, ft = { 'markdown' }, ---@module 'render-markdown' ---@type render.md.UserConfig diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 438d888..3aaa818 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -48,7 +48,7 @@ return { -- Fuzzy Finder (files, lsp, etc) cmd = 'Telescope', branch = 'master', dependencies = { - { 'nvim-treesitter/nvim-treesitter' }, + { 'neovim-treesitter/nvim-treesitter' }, 'nvim-lua/plenary.nvim', { 'nvim-telescope/telescope-ui-select.nvim' }, -- 2.51.2