This commit is contained in:
2025-10-08 10:12:22 +02:00
parent a28447db2f
commit 98c86a57f0
3 changed files with 45 additions and 37 deletions

View File

@@ -2,10 +2,12 @@ return {
{
"nvim-treesitter/nvim-treesitter",
version = false,
lazy = false, -- <- wichtig: vor FileType-Kram geladen
priority = 1000, -- <- noch davor
build = ":TSUpdate",
main = "nvim-treesiter.configs",
-- 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 {}, {
@@ -23,5 +25,20 @@ return {
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,
},
}