language/cue: migrate to vim.lsp.servers

This commit is contained in:
Ching Pei Yang 2025-04-06 01:59:33 +02:00
commit 4c83dd5895
No known key found for this signature in database
GPG key ID: B3841364253DC4C8

View file

@ -4,11 +4,17 @@
lib,
...
}: let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.options) mkEnableOption;
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.types) package;
inherit (lib.nvim.types) mkGrammarOption;
lspOptions = {
cmd = [(getExe pkgs.cue) "lsp"];
filetypes = ["cue"];
root_markers = ["cue.mod" ".git"];
};
cfg = config.vim.languages.cue;
in {
options.vim.languages.cue = {
@ -22,12 +28,6 @@ in {
lsp = {
enable = mkEnableOption "CUE LSP support" // {default = config.vim.lsp.enable;};
package = mkOption {
type = package;
default = pkgs.cue;
description = "cue lsp implementation";
};
};
};
@ -38,14 +38,7 @@ in {
})
(mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.cue-lsp = ''
lspconfig.cue.setup {
capabilities = capabilities,
on_attach = default_on_attach,
cmd = {"${cfg.lsp.package}/bin/cue", "lsp"},
}
'';
vim.lsp.servers.cue = lspOptions;
})
]);
}