lsp/preset/gitlab-ci-ls: init

This commit is contained in:
Snoweuph 2026-06-19 22:38:21 +02:00
commit 85c7ba8227
No known key found for this signature in database
GPG key ID: BEFC41DA223CEC55
5 changed files with 48 additions and 19 deletions

View file

@ -348,6 +348,8 @@
- Add `emmet-ls` to the supported LSPs for all languages it supports.
- Added `gitlab-ci-ls`.
- Added `phpantom` LSP preset and into `languages.php`.
- Moved extra diagnostic modules under `diagnostics.presets.<name>` this will

View file

@ -86,21 +86,13 @@ in {
config = mkIf cfg.enable (mkMerge [
{
vim.autocmds = [
# Without this the LSP doesn't understand them correctly
# and there are conflicts with the YAML LSP
{
desc = "Set Docker Compose filetype";
event = ["BufRead" "BufNewFile"];
pattern = [
"compose.yml"
"compose.yaml"
"docker-compose.yml"
"docker-compose.yaml"
];
command = "set filetype=dockercompose";
}
];
# Without this the LSP doesn't understand them correctly
# and there are conflicts with the YAML LSP,
# thus this module is "stealing" those files.
vim.filetype.pattern = {
"compose%.ya?ml" = "dockercompose";
"docker%-compose%.ya?ml" = "dockercompose";
};
}
(mkIf cfg.treesitter.enable {

View file

@ -13,7 +13,7 @@
cfg = config.vim.languages.yaml;
defaultServers = ["yaml-language-server"];
servers = ["yaml-language-server"];
servers = ["yaml-language-server" "gitlab-ci-ls"];
in {
options.vim.languages.yaml = {
enable = mkEnableOption "YAML language support";
@ -45,11 +45,21 @@ in {
};
config = mkIf cfg.enable (mkMerge [
{
# The GitLab CI LSP ignores all filetypes which aren't `yaml.gitlab`.
vim.filetype.pattern = {
"%.gitlab%-ci%.ya?ml" = "yaml.gitlab";
"%.gitlab/.*%.ya?ml" = "yaml.gitlab";
"templates/.*%.ya?ml" = "yaml.gitlab";
"templates/.*/template%.ya?ml" = "yaml.gitlab";
};
}
(mkIf cfg.treesitter.enable {
vim.treesitter = {
enable = true;
grammars = [cfg.treesitter.package];
filetypeMappings.yaml = ["yml"];
filetypeMappings.yaml = ["yml" "yaml.gitlab"];
};
})
@ -57,7 +67,7 @@ in {
vim.lsp = {
presets = genAttrs cfg.lsp.servers (_: {enable = true;});
servers = genAttrs cfg.lsp.servers (_: {
filetypes = ["yaml"];
filetypes = ["yaml" "yaml.gitlab"];
});
};
})

View file

@ -19,12 +19,13 @@
./emmet-ls.nix
./fish-lsp.nix
./fsautocomplete.nix
./gitlab-ci-ls.nix
./gleam.nix
./glsl_analyzer.nix
./gopls.nix
./harper.nix
./helm-ls.nix
./haskell-language-server.nix
./helm-ls.nix
./intelephense.nix
./jdt-language-server.nix
./jinja-lsp.nix

View file

@ -0,0 +1,24 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf;
inherit (lib.nvim.types) mkLspPresetEnableOption;
cfg = config.vim.lsp.presets.gitlab-ci-ls;
in {
options.vim.lsp.presets.gitlab-ci-ls = {
enable = mkLspPresetEnableOption "gitlab-ci-ls" "GitLab CI" [];
};
config = mkIf cfg.enable {
vim.lsp.servers.gitlab-ci-ls = {
enable = true;
cmd = [(getExe pkgs.gitlab-ci-ls)];
root_markers = [".git" ".gitlab"];
};
};
}