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_ls): use root_dir to decide whether to attach #3558

Merged
merged 4 commits into from
Jan 13, 2025
Merged
Changes from 1 commit
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
21 changes: 8 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,14 @@ 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' },
root_dir = function(filename)
if not filename:find('/%.github/workflows/.+%.ya?ml') then
return
end
return util.root_pattern('.github')
chrisgrieser marked this conversation as resolved.
Show resolved Hide resolved
end,
single_file_support = false,
chrisgrieser marked this conversation as resolved.
Show resolved Hide resolved
chrisgrieser marked this conversation as resolved.
Show resolved Hide resolved
capabilities = {
workspace = {
didChangeWorkspaceFolders = {
Expand All @@ -20,16 +25,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