mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-04-26 19:37:36 +00:00
languages/cue: refactor lsp.servers to use lsp/presets/<name>
This commit is contained in:
parent
436414e549
commit
b5d6c6fad7
1 changed files with 17 additions and 8 deletions
|
|
@ -4,16 +4,14 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption literalExpression;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.options) mkEnableOption literalExpression mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.types) enum listOf;
|
||||
inherit (lib) genAttrs;
|
||||
|
||||
lspOptions = {
|
||||
cmd = [(getExe pkgs.cue) "lsp"];
|
||||
filetypes = ["cue"];
|
||||
root_markers = ["cue.mod" ".git"];
|
||||
};
|
||||
defaultServers = ["cue"];
|
||||
servers = ["cue"];
|
||||
|
||||
cfg = config.vim.languages.cue;
|
||||
in {
|
||||
|
|
@ -38,6 +36,12 @@ in {
|
|||
default = config.vim.lsp.enable;
|
||||
defaultText = literalExpression "config.vim.lsp.enable";
|
||||
};
|
||||
|
||||
servers = mkOption {
|
||||
type = listOf (enum servers);
|
||||
default = defaultServers;
|
||||
description = "CUE LSP server to use";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -48,7 +52,12 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.servers.cue = lspOptions;
|
||||
vim.lsp = {
|
||||
presets = genAttrs cfg.lsp.servers (_: {enable = true;});
|
||||
servers = genAttrs cfg.lsp.servers (_: {
|
||||
filetypes = ["cue"];
|
||||
});
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue