From 4e361c73cb58e8aae0dfa501052bd1133be18bbe Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Fri, 11 Oct 2024 00:20:51 +0200 Subject: [PATCH] Neovim: Fix ltex_extra loading before ltex was attached --- home/modules/neovim/default.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/home/modules/neovim/default.nix b/home/modules/neovim/default.nix index 2217f03f..d99e8b36 100644 --- a/home/modules/neovim/default.nix +++ b/home/modules/neovim/default.nix @@ -913,7 +913,13 @@ in { -- Make LspInfo window border rounded require("lspconfig.ui.windows").default_options.border = "rounded" - local __lspOnAttach = function(client, bufnr) end + local __lspOnAttach = function(client, bufnr) + -- NOTE: The ltex-extra package needs to be loaded in ltex's onAttach. + -- I don't know how to do this more declaratively with the current structure. + if client.name == "ltex" then + require("ltex_extra").setup({}) + end + end local __lspCapabilities = function() capabilities = vim.lsp.protocol.make_client_capabilities() @@ -1015,7 +1021,10 @@ in { lazy = true; ft = ["markdown" "tex"]; dependencies = [lspconfig]; - config = mkDefaultConfig name; + config = '' + -- Do nothing, as we call require("ltex_extra") in ltex's onAttach + function(_, opts) end + ''; }; markview = {