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

@@ -15,7 +15,6 @@
"lazyvim.plugins.extras.editor.snacks_picker",
"lazyvim.plugins.extras.editor.telescope",
"lazyvim.plugins.extras.formatting.prettier",
"lazyvim.plugins.extras.lang.haskell",
"lazyvim.plugins.extras.lang.json",
"lazyvim.plugins.extras.lang.markdown",
"lazyvim.plugins.extras.lang.nix",

View File

@@ -1,40 +1,32 @@
return {
{
"mrcjkb/haskell-tools.nvim",
ft = { "haskell", "lhaskell", "cabal" },
dependencies = { "L3MON4D3/LuaSnip", "nvim-treesitter/nvim-treesitter" },
opts = {
-- WICHTIG: expliziter Modulname; Lazy soll NICHT raten
main = "haskell-tools",
ft = { "haskell", "lhaskell", "cabal", "cabalproject" },
-- Gib Lazy NICHT die Chance, sein Auto-setup zu machen:
-- Wir liefern EINE eigene config-Funktion und rufen setup() selbst.
config = function(_, _)
local ok, ht = pcall(require, "haskell-tools")
if not ok or type(ht.setup) ~= "function" then
vim.notify("[haskell-tools] setup() nicht gefunden wird übersprungen", vim.log.levels.ERROR)
return
end
ht.setup({
hls = {
-- Dein Nix-HLS, damit Mason außen vor bleibt
cmd = { "haskell-language-server-wrapper", "--lsp" },
settings = {
haskell = {
formattingProvider = "fourmolu",
-- wir nutzen das interne Plugin, kein externes Binary nötig:
plugin = { fourmolu = { config = { external = false } } },
-- .cabal-Formatting komplett deaktivieren (sonst verlangt HLS cabal-fmt)
cabalFormattingProvider = "none",
plugin = { fourmolu = { config = { external = false } } },
},
},
},
-- optional: Safety im on_attach
on_attach = function(client, bufnr)
if vim.bo[bufnr].filetype == "cabal" then
client.server_capabilities.documentFormattingProvider = false
end
end,
-- falls Lazy mal falsch cached: lade LuaSnip aktiv vorher
init = function()
if not package.loaded["luasnip"] then
local ok, lazy = pcall(require, "lazy")
if ok then
lazy.load({ plugins = { "LuaSnip" } })
end
end
end,
-- lade nur, wenn require("luasnip") wirklich klappt
cond = function()
return package.loaded["luasnip"] or pcall(require, "luasnip")
})
end,
},
}

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