Files
snippets/nvim-config/lua/plugins/nvim-treesitter.lua
2025-10-08 10:12:22 +02:00

45 lines
1.3 KiB
Lua

return {
{
"nvim-treesitter/nvim-treesitter",
version = false,
build = ":TSUpdate",
-- Lazy ruft automatisch: require(main).setup(opts)
-- => Wir brauchen KEIN require('nvim-treesitter.configs') mehr.
main = "nvim-treesitter.configs",
opts = function(_, opts)
opts = opts or {}
opts.ensure_installed = vim.tbl_extend("force", opts.ensure_installed or {}, {
"haskell",
"lua",
"vim",
"bash",
"regex",
"vimdoc",
"query",
"markdown",
"markdown_inline",
})
opts.highlight = opts.highlight or {}
opts.highlight.enable = true
return opts
end,
-- Nur der Shim; KEIN require('nvim-treesitter.configs') hier!
config = function()
local ok, parsers = pcall(require, "nvim-treesitter.parsers")
if ok and parsers and parsers.ft_to_lang == nil then
local langmod = vim.treesitter.language
if langmod and type(langmod.get_lang) == "function" then
parsers.ft_to_lang = function(ft)
return langmod.get_lang(ft) or ft
end
elseif type(parsers.filetype_to_parsername) == "function" then
parsers.ft_to_lang = parsers.filetype_to_parsername
end
end
end,
},
}