mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
modules/lsp: check if server settings
is empty
Avoid unnecessary lua lines by checking if `server.settings` is empty before writing `vim.lsp.config()` to `init.lua`.
This commit is contained in:
parent
f2e96b67a3
commit
b6e2016b7f
1 changed files with 5 additions and 7 deletions
|
@ -179,16 +179,14 @@ in
|
|||
luaName = toLuaObject server.name;
|
||||
luaSettings = toLuaObject server.settings;
|
||||
in
|
||||
''
|
||||
vim.lsp.config(${luaName}, ${luaSettings})
|
||||
''
|
||||
+ lib.optionalString (server.activate or false) ''
|
||||
vim.lsp.enable(${luaName})
|
||||
'';
|
||||
[
|
||||
(lib.mkIf (server.settings != { }) "vim.lsp.config(${luaName}, ${luaSettings})")
|
||||
(lib.mkIf (server.activate or false) "vim.lsp.enable(${luaName})")
|
||||
];
|
||||
in
|
||||
lib.mkMerge (
|
||||
lib.optional cfg.inlayHints.enable "vim.lsp.inlay_hint.enable(true)"
|
||||
++ builtins.map mkServerConfig enabledServers
|
||||
++ builtins.concatMap mkServerConfig enabledServers
|
||||
);
|
||||
|
||||
extraConfigLua = lib.mkIf (cfg.luaConfig.content != "") ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue