From dd5f2f50ddaaa34d788b60e0452190121acb5fe0 Mon Sep 17 00:00:00 2001 From: disrupted Date: Thu, 9 Jan 2025 12:06:31 +0100 Subject: [PATCH 1/4] feat: gh-actions-language-server --- lua/lspconfig/configs/gh_actions_ls.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lua/lspconfig/configs/gh_actions_ls.lua diff --git a/lua/lspconfig/configs/gh_actions_ls.lua b/lua/lspconfig/configs/gh_actions_ls.lua new file mode 100644 index 0000000000..baf314c6ab --- /dev/null +++ b/lua/lspconfig/configs/gh_actions_ls.lua @@ -0,0 +1,23 @@ +local util = require 'lspconfig.util' + +return { + default_config = { + cmd = { 'gh-actions-language-server', '--stdio' }, + filetypes = { 'yaml.github' }, + root_dir = util.root_pattern('.github', '.git'), + single_file_support = true, + }, + docs = { + description = [[ +https://github.com/lttb/gh-actions-language-server + +Language server for GitHub Actions. + +`gh-actions-language-server` can be installed via `npm`: + +```sh +npm install -g gh-actions-language-server +``` +]], + }, +} From 53e433cc15a51aa7713b3fdd77897fb592a61602 Mon Sep 17 00:00:00 2001 From: disrupted Date: Thu, 9 Jan 2025 18:19:50 +0100 Subject: [PATCH 2/4] refactor: only allow `.github` in root pattern --- lua/lspconfig/configs/gh_actions_ls.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lspconfig/configs/gh_actions_ls.lua b/lua/lspconfig/configs/gh_actions_ls.lua index baf314c6ab..cff751e069 100644 --- a/lua/lspconfig/configs/gh_actions_ls.lua +++ b/lua/lspconfig/configs/gh_actions_ls.lua @@ -4,7 +4,7 @@ return { default_config = { cmd = { 'gh-actions-language-server', '--stdio' }, filetypes = { 'yaml.github' }, - root_dir = util.root_pattern('.github', '.git'), + root_dir = util.root_pattern('.github'), single_file_support = true, }, docs = { From a1a73fc0a215dbbe4b5be31f12f7eb4f55e62df9 Mon Sep 17 00:00:00 2001 From: disrupted Date: Thu, 9 Jan 2025 18:20:17 +0100 Subject: [PATCH 3/4] fix: set dynamic registration for didChangeWorkspaceFolders was getting a warning about this in lsp.log --- lua/lspconfig/configs/gh_actions_ls.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/lspconfig/configs/gh_actions_ls.lua b/lua/lspconfig/configs/gh_actions_ls.lua index cff751e069..1ffc09160e 100644 --- a/lua/lspconfig/configs/gh_actions_ls.lua +++ b/lua/lspconfig/configs/gh_actions_ls.lua @@ -6,6 +6,13 @@ return { filetypes = { 'yaml.github' }, root_dir = util.root_pattern('.github'), single_file_support = true, + capabilities = { + workspace = { + didChangeWorkspaceFolders = { + dynamicRegistration = true, + }, + }, + }, }, docs = { description = [[ From aed379d76d68e2e5cd63ab3b8849db25e48bcb1d Mon Sep 17 00:00:00 2001 From: disrupted Date: Mon, 13 Jan 2025 09:07:29 +0100 Subject: [PATCH 4/4] docs: describe filetype pattern --- lua/lspconfig/configs/gh_actions_ls.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lua/lspconfig/configs/gh_actions_ls.lua b/lua/lspconfig/configs/gh_actions_ls.lua index 1ffc09160e..b745158516 100644 --- a/lua/lspconfig/configs/gh_actions_ls.lua +++ b/lua/lspconfig/configs/gh_actions_ls.lua @@ -20,6 +20,16 @@ https://github.com/lttb/gh-actions-language-server Language server for GitHub Actions. +The server is registered for the special `yaml.github` filetype. You need to configure this filetype pattern for GitHub workflow files. + +```lua +vim.filetype.add({ + pattern = { + ['.*/%.github[%w/]+workflows[%w/]+.*%.ya?ml'] = 'yaml.github', + }, +}) +``` + `gh-actions-language-server` can be installed via `npm`: ```sh