Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: gh-actions-language-server #3551

Merged
merged 4 commits into from
Jan 13, 2025
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
40 changes: 40 additions & 0 deletions lua/lspconfig/configs/gh_actions_ls.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
local util = require 'lspconfig.util'

return {
default_config = {
cmd = { 'gh-actions-language-server', '--stdio' },
filetypes = { 'yaml.github' },
root_dir = util.root_pattern('.github'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that root_dir can be a function, so it could inspect the contents of every .yaml file to decide if it's a GH workflow.

I'll leave that as a followup for now.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's a standard way to identify GitHub YAML anyway. I mean, there are some specifics like inputs, maybe? But they're optional - there's also the slight difference between Workflow & Action so detecting this wouldn't be reliable anyway I think.

single_file_support = true,
capabilities = {
workspace = {
didChangeWorkspaceFolders = {
dynamicRegistration = true,
},
},
},
},
docs = {
description = [[
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
npm install -g gh-actions-language-server
```
]],
},
}
Loading