Skip to content

Commit 56d0c45

Browse files
committed
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.
1 parent b0906ac commit 56d0c45

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

plugins/by-name/typescript-tools/default.nix

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,10 @@ lib.nixvim.plugins.mkNeovimPlugin {
191191
};
192192
};
193193

194-
# NOTE: call setup in lsp config
194+
# NOTE: call setup manually
195195
callSetup = false;
196+
# Set up after lspconfig
197+
configLocation = "extraConfigLuaPost";
196198
extraConfig =
197199
cfg:
198200
let
@@ -221,8 +223,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
221223
];
222224
in
223225
{
224-
# TODO: handle lazy loading properly
225-
plugins.lsp.postConfig =
226+
plugins.typescript-tools.luaConfig.content =
226227
let
227228
# TODO:: introduced 10-22-2024: remove after 24.11
228229
renamedSettings = lib.foldl' (
@@ -253,7 +254,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
253254
);
254255

255256
setupOptions =
256-
filterAttrsRecursivePath (path: value: !builtins.elem path definedOpts) cfg.settings [ ]
257+
filterAttrsRecursivePath (path: _: !builtins.elem path definedOpts) cfg.settings [ ]
257258
// {
258259
settings = lib.recursiveUpdate cfg.settings.settings renamedSettings;
259260
};

tests/test-sources/plugins/by-name/typescript-tools/default.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
example = {
3535
plugins.typescript-tools = {
3636
enable = true;
37+
luaConfig.pre = ''
38+
local api = require("typescript-tools.api")
39+
'';
3740
settings = {
3841
handlers = {
3942
"textDocument/publishDiagnostics" = ''

0 commit comments

Comments
 (0)