mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-04-15 09:08:37 +00:00
lsp: add default fallback config
This commit is contained in:
parent
05e39f3f92
commit
b2f6c60221
1 changed files with 20 additions and 9 deletions
|
@ -3,11 +3,13 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (builtins) filter;
|
||||||
|
inherit (lib.modules) mkIf mkMerge mkDefault;
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.types) attrsOf;
|
inherit (lib.types) attrsOf;
|
||||||
inherit (lib.strings) concatLines;
|
inherit (lib.strings) concatLines;
|
||||||
inherit (lib.attrsets) mapAttrsToList attrNames filterAttrs;
|
inherit (lib.attrsets) mapAttrsToList attrNames filterAttrs;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.languages) lspOptions;
|
inherit (lib.nvim.languages) lspOptions;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
@ -32,13 +34,22 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf (cfg.servers != {}) {
|
config = mkMerge [
|
||||||
vim.luaConfigRC.lsp-servers = entryAnywhere ''
|
{
|
||||||
-- Individual LSP configurations managed by nvf.
|
vim.lsp.servers."*" = {
|
||||||
${(concatLines lspConfigurations)}
|
capabilities = mkDefault (mkLuaInline "capabilities");
|
||||||
|
on_attach = mkDefault (mkLuaInline "default_on_attach");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
-- Enable configured LSPs explicitly
|
(mkIf (cfg.servers != {}) {
|
||||||
vim.lsp.enable(${toLuaObject (attrNames enabledServers)})
|
vim.luaConfigRC.lsp-servers = entryAnywhere ''
|
||||||
'';
|
-- Individual LSP configurations managed by nvf.
|
||||||
};
|
${(concatLines lspConfigurations)}
|
||||||
|
|
||||||
|
-- Enable configured LSPs explicitly
|
||||||
|
vim.lsp.enable(${toLuaObject (filter (name: name != "*") (attrNames enabledServers))})
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue