This is an independent project and not an official GitLab product.
It is intended to be used alongside yaml-language-server (yamlls), providing specialized support for GitLab CI files without replacing yamlls.
jobs, includes, variables,
needs, extends, components, stages and variables.jobs, extends and stages.extends, stages, needs, variables, included projects files and components.extends references, stage definitions, job needs usage and components.It also supports jump to included files. In case it is a remote file it tries to downloading using current workspace git setup and caches it locally.
Note that this video doesn't include all functionalities.
Initialization options:
cache: location for cached remote files
log_path: location for LS log
variables: map of CI variable names to values, used to expand $VAR/${VAR} occurrences in include: project: and ref: values. Variables not present in the map fall back to the process environment; unknown variables are left untouched. This is needed when includes are parameterized through instance- or group-level CI variables that only exist on the GitLab server. For example, every project on drupal.org's GitLab uses:
include:
- project: $_GITLAB_TEMPLATES_REPO
ref: $_GITLAB_TEMPLATES_REF
file: "/includes/include.drupalci.main.yml"
which resolves with:
{
"variables": {
"_GITLAB_TEMPLATES_REPO": "project/gitlab_templates",
"_GITLAB_TEMPLATES_REF": "default-ref"
}
}
options:
false.gitlab-ci-ls.yml)For projects that do not have a standard .gitlab-ci.yml file at their root (e.g., GitLab CI template projects that define reusable components without a pipeline of their own), you can specify the root CI files using a .gitlab-ci-ls.yml file in your project's root directory. This allows the language server to correctly identify and process your GitLab CI configurations.
The .gitlab-ci-ls.yml file should contain a root_files key, which is a list of paths to your main GitLab CI files. These paths can be:
.gitlab-ci.yml or .gitlab-ci.yaml files.
Example: ["path/to/my-pipeline.gitlab-ci.yml"].gitlab-ci.yml or .gitlab-ci.yaml files within the specified directories.
Example: ["pipelines/"]["templates/**/*.gitlab-ci.yml"]You can combine these types in a single list to cover all your root CI files.
Example .gitlab-ci-ls.yml:
root_files:
- pipeline1/.gitlab-ci.yml
- pipeline2/.gitlab-ci.yml
- shared-templates/**/*.gitlab-ci.yml
- ci-configs/
Hint: On Linux you have to install the package libssl-dev and pkg-config (On Debian based distributions)
respectively openssl-devel and pkgconf (On RedHat based distributions) when you use Cargo or Mason installation.
brew install alesbrelih/gitlab-ci-ls/gitlab-ci-ls Hint: Since Homebrew version 6 you have to trust 3rd party taps.cargo install gitlab-ci-ls Hint: You may have to add $HOME/.cargo/bin to your $PATH env var.cargo build --release
Executable can then be found at target/release/gitlab-ci-ls
Easiest way to use this using neovim is to install it using mason with combination of mason-lspconfig.
Important: To use it now you will have to set correct file type. Before it was attached on
yaml file types, but I have decided that it brings too much confusion.
Example how to add it:
vim.filetype.add({
pattern = {
['%.gitlab%-ci%.ya?ml'] = 'yaml.gitlab',
},
})
Extension can be found 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.

To use gitlab-ci-ls with Emacs lsp-mode, reference the below sample
configuration.
(add-to-list 'lsp-language-id-configuration '("\\.gitlab-ci\\.yml$" . "gitlabci"))
(add-to-list 'lsp-language-id-configuration '("/ci-templates/.*\\.yml$" . "gitlabci"))
(lsp-register-custom-settings
'(("gitlabci.cache" "/path/where/remote/folders/will/be/cached")
("gitlabci.log_path" "/tmp/gitlab-ci-ls.log")))
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection '("gitlab-ci-ls"))
:activation-fn (lsp-activate-on "gitlabci")
:server-id 'gitlabci
:priority 10
:initialization-options (lambda () (gethash "gitlabci" (lsp-configuration-section "gitlabci")))))
Rust
98.8%
TypeScript
1.2%
This is an independent project and not an official GitLab product.
It is intended to be used alongside yaml-language-server (yamlls), providing specialized support for GitLab CI files without replacing yamlls.
jobs, includes, variables,
needs, extends, components, stages and variables.jobs, extends and stages.extends, stages, needs, variables, included projects files and components.extends references, stage definitions, job needs usage and components.It also supports jump to included files. In case it is a remote file it tries to downloading using current workspace git setup and caches it locally.
Note that this video doesn't include all functionalities.
Initialization options:
cache: location for cached remote files
log_path: location for LS log
variables: map of CI variable names to values, used to expand $VAR/${VAR} occurrences in include: project: and ref: values. Variables not present in the map fall back to the process environment; unknown variables are left untouched. This is needed when includes are parameterized through instance- or group-level CI variables that only exist on the GitLab server. For example, every project on drupal.org's GitLab uses:
include:
- project: $_GITLAB_TEMPLATES_REPO
ref: $_GITLAB_TEMPLATES_REF
file: "/includes/include.drupalci.main.yml"
which resolves with:
{
"variables": {
"_GITLAB_TEMPLATES_REPO": "project/gitlab_templates",
"_GITLAB_TEMPLATES_REF": "default-ref"
}
}
options:
false.gitlab-ci-ls.yml)For projects that do not have a standard .gitlab-ci.yml file at their root (e.g., GitLab CI template projects that define reusable components without a pipeline of their own), you can specify the root CI files using a .gitlab-ci-ls.yml file in your project's root directory. This allows the language server to correctly identify and process your GitLab CI configurations.
The .gitlab-ci-ls.yml file should contain a root_files key, which is a list of paths to your main GitLab CI files. These paths can be:
.gitlab-ci.yml or .gitlab-ci.yaml files.
Example: ["path/to/my-pipeline.gitlab-ci.yml"].gitlab-ci.yml or .gitlab-ci.yaml files within the specified directories.
Example: ["pipelines/"]["templates/**/*.gitlab-ci.yml"]You can combine these types in a single list to cover all your root CI files.
Example .gitlab-ci-ls.yml:
root_files:
- pipeline1/.gitlab-ci.yml
- pipeline2/.gitlab-ci.yml
- shared-templates/**/*.gitlab-ci.yml
- ci-configs/
Hint: On Linux you have to install the package libssl-dev and pkg-config (On Debian based distributions)
respectively openssl-devel and pkgconf (On RedHat based distributions) when you use Cargo or Mason installation.
brew install alesbrelih/gitlab-ci-ls/gitlab-ci-ls Hint: Since Homebrew version 6 you have to trust 3rd party taps.cargo install gitlab-ci-ls Hint: You may have to add $HOME/.cargo/bin to your $PATH env var.cargo build --release
Executable can then be found at target/release/gitlab-ci-ls
Easiest way to use this using neovim is to install it using mason with combination of mason-lspconfig.
Important: To use it now you will have to set correct file type. Before it was attached on
yaml file types, but I have decided that it brings too much confusion.
Example how to add it:
vim.filetype.add({
pattern = {
['%.gitlab%-ci%.ya?ml'] = 'yaml.gitlab',
},
})
Extension can be found 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.

To use gitlab-ci-ls with Emacs lsp-mode, reference the below sample
configuration.
(add-to-list 'lsp-language-id-configuration '("\\.gitlab-ci\\.yml$" . "gitlabci"))
(add-to-list 'lsp-language-id-configuration '("/ci-templates/.*\\.yml$" . "gitlabci"))
(lsp-register-custom-settings
'(("gitlabci.cache" "/path/where/remote/folders/will/be/cached")
("gitlabci.log_path" "/tmp/gitlab-ci-ls.log")))
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection '("gitlab-ci-ls"))
:activation-fn (lsp-activate-on "gitlabci")
:server-id 'gitlabci
:priority 10
:initialization-options (lambda () (gethash "gitlabci" (lsp-configuration-section "gitlabci")))))
Rust
98.8%
TypeScript
1.2%