Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions lua/lspconfig/configs/gh_actions_ls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@ local util = require 'lspconfig.util'
return {
default_config = {
cmd = { 'gh-actions-language-server', '--stdio' },
filetypes = { 'yaml.github' },
root_dir = util.root_pattern('.github'),
single_file_support = true,
filetypes = { 'yaml' },

-- Only attach to yaml files that are GitHub workflows instead of all yaml
-- files. (A nil root_dir and no single_file_support results in the LSP not
-- attaching.) For details, see #3558
root_dir = function(filename)
return filename:find('/%.github/workflows/.+%.ya?ml') and util.root_pattern('.github') or nil
end,
-- Disabling "single file support" is a hack to avoid enabling this LS for
-- every random yaml file, so `root_dir()` can control the enablement.
single_file_support = false,

capabilities = {
workspace = {
didChangeWorkspaceFolders = {
Expand All @@ -20,16 +29,6 @@ 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
Expand Down
Loading