Skip to content

Commit bf6177e

Browse files
feat: zizmor #4382
1 parent 3c156ab commit bf6177e

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

lsp/zizmor.lua

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---@brief
2+
---
3+
--- https://github.com/zizmorcore/zizmor
4+
---
5+
--- Zizmor language server.
6+
---
7+
--- `zizmor` can be installed by following the instructions [here](https://docs.zizmor.sh/installation/).
8+
---
9+
--- The default `cmd` assumes that the `zizmor` binary can be found in `$PATH`.
10+
---
11+
--- See `zizmor`'s [documentation](https://docs.zizmor.sh/) for additional documentation.
12+
13+
---@type vim.lsp.Config
14+
return {
15+
cmd = { 'zizmor', '--lsp' },
16+
filetypes = { 'yaml' },
17+
18+
-- `root_dir` ensures that the LSP does not attach to all yaml files
19+
root_dir = function(bufnr, on_dir)
20+
local bufname = vim.api.nvim_buf_get_name(bufnr)
21+
local parent = vim.fs.dirname(bufname)
22+
if
23+
vim.endswith(parent, '/.github/workflows')
24+
or vim.endswith(parent, '/.forgejo/workflows')
25+
or vim.endswith(parent, '/.gitea/workflows')
26+
or (vim.endswith(bufname, '/.github/dependabot.yml') or vim.endswith(bufname, '/.github/dependabot.yaml'))
27+
or vim.endswith(bufname, 'action.yml') -- Composite actions can live in any repository subdirectory
28+
then
29+
on_dir(parent)
30+
end
31+
end,
32+
init_options = {}, -- needs to be present https://github.com/neovim/nvim-lspconfig/pull/3713#issuecomment-2857394868
33+
capabilities = {
34+
workspace = {
35+
didChangeWorkspaceFolders = {
36+
dynamicRegistration = true,
37+
},
38+
},
39+
},
40+
}

0 commit comments

Comments
 (0)