Fix treesitter config module name for current nvim-treesitter

This commit is contained in:
2026-02-09 16:59:23 +11:00
parent 5af65cd11d
commit bd2f28ff81

View File

@@ -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,
}