Crates.io | gitlab-ci-ls |
lib.rs | gitlab-ci-ls |
version | 0.22.0 |
source | src |
created_at | 2024-04-03 13:37:55.108065 |
updated_at | 2024-10-21 19:42:26.595979 |
description | Language server for Gitlab CI |
homepage | |
repository | https://github.com/alesbrelih/gitlab-ci-ls |
max_upload_size | |
id | 1195049 |
size | 946,458 |
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
and variables
.jobs
, extends
and stages
.extends
, stages
, needs
, variables
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:
brew install alesbrelih/gitlab-ci-ls/gitlab-ci-ls
cargo install gitlab-ci-ls
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.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
pattern = "*.gitlab-ci*.{yml,yaml}",
callback = function()
vim.bo.filetype = "yaml.gitlab"
end,
})
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")))))