plugins/typescript-tools: use plugin's luaConfig

When lazy loading, we need to isolate the plugin's config otherwise it
will fail because the generated config is still loaded immediately in
lspconfig's lua.
This commit is contained in:
Austin Horstman 2025-02-02 10:02:49 -06:00
parent b0906aca2e
commit 56d0c4579e
No known key found for this signature in database
2 changed files with 8 additions and 4 deletions

View file

@ -191,8 +191,10 @@ lib.nixvim.plugins.mkNeovimPlugin {
};
};
# NOTE: call setup in lsp config
# NOTE: call setup manually
callSetup = false;
# Set up after lspconfig
configLocation = "extraConfigLuaPost";
extraConfig =
cfg:
let
@ -221,8 +223,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
];
in
{
# TODO: handle lazy loading properly
plugins.lsp.postConfig =
plugins.typescript-tools.luaConfig.content =
let
# TODO:: introduced 10-22-2024: remove after 24.11
renamedSettings = lib.foldl' (
@ -253,7 +254,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
);
setupOptions =
filterAttrsRecursivePath (path: value: !builtins.elem path definedOpts) cfg.settings [ ]
filterAttrsRecursivePath (path: _: !builtins.elem path definedOpts) cfg.settings [ ]
// {
settings = lib.recursiveUpdate cfg.settings.settings renamedSettings;
};

View file

@ -34,6 +34,9 @@
example = {
plugins.typescript-tools = {
enable = true;
luaConfig.pre = ''
local api = require("typescript-tools.api")
'';
settings = {
handlers = {
"textDocument/publishDiagnostics" = ''