BREAKING CHANGE: Migrate to nvim-treesitter main branch #3295
Users must now use the :TSInstallAll command to install all treesitter parsers defined in their config. So there's no automatic downloading of treesitter parsers like before tree-sitter-cli is a required dependency now --------- Co-authored-by: siduck <siduck@tutanota.com>
This commit is contained in:
co-authored by
siduck
parent
30e75dbbdf
commit
6a0715d3f3
@@ -25,3 +25,18 @@ autocmd({ "UIEnter", "BufReadPost", "BufNewFile" }, {
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
pcall(vim.treesitter.start)
|
||||
end,
|
||||
})
|
||||
|
||||
local create_cmd = vim.api.nvim_create_user_command
|
||||
|
||||
create_cmd("TSInstallAll", function()
|
||||
local spec = require("lazy.core.config").plugins["nvim-treesitter"]
|
||||
local opts = type(spec.opts) == "table" and spec.opts or {}
|
||||
require("nvim-treesitter").install(opts.ensure_installed)
|
||||
end, {})
|
||||
|
||||
@@ -5,11 +5,4 @@ end)
|
||||
|
||||
return {
|
||||
ensure_installed = { "lua", "luadoc", "printf", "vim", "vimdoc" },
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
use_languagetree = true,
|
||||
},
|
||||
|
||||
indent = { enable = true },
|
||||
}
|
||||
|
||||
@@ -156,15 +156,11 @@ return {
|
||||
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
branch = "master",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
|
||||
build = ":TSUpdate",
|
||||
build = ":TSUpdate | TSInstallAll",
|
||||
opts = function()
|
||||
return require "nvchad.configs.treesitter"
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user