Skip to content

Commit 395bca8

Browse files
committed
chore(lsp): setup_wrapper as variable
1 parent d0ab478 commit 395bca8

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

modules/nixvim/lsp.nix

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,26 @@ in
4141
(keymap.n "<leader>wl" (mkRawFn ''print(vim.inspect(vim.lsp.buf.list_workspace_folders()))'') "List workspace folders" {})
4242
];
4343

44-
setupWrappers = let
45-
capabilities = toLuaObject {
44+
setupWrappers = [
45+
(str: /* lua */ ''
46+
vim.tbl_deep_extend("force", wrap_lsp_config, ${str})
47+
'')
48+
];
49+
};
50+
extraConfigLua = let
51+
wrapConfig = toLuaObject {
52+
on_init = mkRawFn ["client" "_"] ''
53+
if vim.fn.has "nvim-0.11" ~= 1 then
54+
if client.supports_method "textDocument/semanticTokens" then
55+
client.server_capabilities.semanticTokensProvider = nil
56+
end
57+
else
58+
if client:supports_method "textDocument/semanticTokens" then
59+
client.server_capabilities.semanticTokensProvider = nil
60+
end
61+
end
62+
'';
63+
capabilities = {
4664
textDocument.completion.completionItem = {
4765
documentationFormat = [ "markdown" "plaintext" ];
4866
snippetSupport = true;
@@ -61,23 +79,8 @@ in
6179
};
6280
};
6381
};
64-
in [
65-
(str: /* lua */ ''
66-
vim.tbl_deep_extend("force", {
67-
on_init = function(client, _)
68-
if vim.fn.has "nvim-0.11" ~= 1 then
69-
if client.supports_method "textDocument/semanticTokens" then
70-
client.server_capabilities.semanticTokensProvider = nil
71-
end
72-
else
73-
if client:supports_method "textDocument/semanticTokens" then
74-
client.server_capabilities.semanticTokensProvider = nil
75-
end
76-
end
77-
end,
78-
capabilities = ${capabilities}
79-
}, ${str})
80-
'')
81-
];
82-
};
82+
};
83+
in lib.mkBefore /* lua */ ''
84+
local wrap_lsp_config = ${wrapConfig}
85+
'';
8386
}

0 commit comments

Comments
 (0)