languages/cue: initial CUE language support (#704)

* feat: add cue language support

* docs: add changelog information
This commit is contained in:
Thales Menato 2025-03-11 06:33:39 -04:00 committed by GitHub
parent 2f02c47c1b
commit bafa6cbf84
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 54 additions and 0 deletions

View file

@ -159,8 +159,10 @@
[thamenato](https://github.com/thamenato): [thamenato](https://github.com/thamenato):
[ruff]: (https://github.com/astral-sh/ruff) [ruff]: (https://github.com/astral-sh/ruff)
[cue]: (https://cuelang.org/)
- Add [ruff] as a formatter option in `vim.languages.python.format.type`. - Add [ruff] as a formatter option in `vim.languages.python.format.type`.
- Add [cue] support under `vim.languages.cue`.
[ARCIII](https://github.com/ArmandoCIII): [ARCIII](https://github.com/ArmandoCIII):

View file

@ -0,0 +1,51 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.types) package;
inherit (lib.nvim.types) mkGrammarOption;
cfg = config.vim.languages.cue;
in {
options.vim.languages.cue = {
enable = mkEnableOption "CUE language support";
treesitter = {
enable = mkEnableOption "CUE treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "cue";
};
lsp = {
enable = mkEnableOption "CUE LSP support" // {default = config.vim.languages.enableLSP;};
package = mkOption {
type = package;
default = pkgs.cue;
description = "cue lsp implementation";
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.package];
})
(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"},
}
'';
})
]);
}

View file

@ -5,6 +5,7 @@ in {
./asm.nix ./asm.nix
./astro.nix ./astro.nix
./bash.nix ./bash.nix
./cue.nix
./dart.nix ./dart.nix
./clang.nix ./clang.nix
./css.nix ./css.nix