Gitlab CI language server
This is not an official language server.
I've developed this LS to help myself working with Gitlab CI files.
Functionalities
Currently it supports only:
- textDocument/definition: Link
- textDocument/hover: Link
- textDocument/completion: Link
- textDocument/diagnostic: Link
- textDocument/diagnostic: Link
Go To Definition
Both extend and main node keys support go to definition. Supports:
- node definitions
- job extends
- job needs
.base-job:
something: ...
myjob:
extends: .base-job
In the case above go to definition is supported for .base-job and myjob (if this is just an override of existing job).
For remote file includes it tries to download referenced git repository and then use its files to jump to definition.
To clone the repository it currently only supports ssh protocol and it automatically tries to use SSH key in SSH agent.
It will try to find the correct remote by reading current working directory remote. In case there are multiple remotes (in cases such as forks) it is best to set the remote using the package_map option.
For example:
{
... other configuration,
package_map: {
"mytemplaterepository": "git@gitlab.com"
}
}
in case where we are including gitlab files from a remote. For example:
include:
- project: mytemplaterepository
ref: 1.0.0
file:
- "/.ci-template.yml"
Otherwise it will clone from the first remote it has access to which doesn't guarantee that this is the file version you want.
Autocomplete
It supports autocompletion for:
- extends
- stages
- job needs
- variables (currently only root variables, per job definition will be added later on)
Diagnostic
It shows diagnostics on:
- invalid extends
- invalid stages
References
It shows references for:
- node keys
- extends
Installing
- Download release and optionally symlink it.
- On mac you can use
brew install alesbrelih/gitlab-ci-ls/gitlab-ci-ls. - Using cargo
cargo install gitlab-ci-ls
Build
Executable can then be found at target/release/gitlab-ci-ls
Integration with Neovim
Currently this tool isn't available on Mason but if there will be interest I will be add it.
If you want to include it to test it you can use:
local client = nil
vim..
Integration with VSCode
Extenstion can be seen here.
This extension supports configuration which needs to be set up because gitlab-ci-ls itself isn't installed along with the extension but it needs to be downloaded from releases, brew or built from source.

TODO
- Smarter way to initialize, it should support root_dir equal to nil and once file is opened it should receive/calculate new root.
- Fix VSCode completion. It seems it also needs a range to correctly update text.
- Rename to gitlab-ci-ls.