aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorCrashdummy <Simon.Schwendele@gmx.de>2025-01-23 13:02:27 +0100
committerGitHub <noreply@github.com>2025-01-23 13:02:27 +0100
commit59760a01596b76b9c6f9a4a299dbffa88d069cf1 (patch)
treea169dcc77c8d65e14170cf0a6585759fb4f6b410 /lua
parentfix: fix incorrect root finding (diff)
downloadnvim-lspconfig-59760a01596b76b9c6f9a4a299dbffa88d069cf1.tar
nvim-lspconfig-59760a01596b76b9c6f9a4a299dbffa88d069cf1.tar.gz
nvim-lspconfig-59760a01596b76b9c6f9a4a299dbffa88d069cf1.tar.bz2
nvim-lspconfig-59760a01596b76b9c6f9a4a299dbffa88d069cf1.tar.lz
nvim-lspconfig-59760a01596b76b9c6f9a4a299dbffa88d069cf1.tar.xz
nvim-lspconfig-59760a01596b76b9c6f9a4a299dbffa88d069cf1.tar.zst
nvim-lspconfig-59760a01596b76b9c6f9a4a299dbffa88d069cf1.zip
fix(gh_actions_ls): fix incorrect rootdir resolution
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/configs/gh_actions_ls.lua20
1 files changed, 15 insertions, 5 deletions
diff --git a/lua/lspconfig/configs/gh_actions_ls.lua b/lua/lspconfig/configs/gh_actions_ls.lua
index 8325e071..60f20629 100644
--- a/lua/lspconfig/configs/gh_actions_ls.lua
+++ b/lua/lspconfig/configs/gh_actions_ls.lua
@@ -1,5 +1,3 @@
-local util = require 'lspconfig.util'
-
return {
default_config = {
cmd = { 'gh-actions-language-server', '--stdio' },
@@ -9,9 +7,21 @@ return {
-- 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|forgejo|gitea)/workflows/.+%.ya?ml')
- and util.root_pattern('.github', '.forgejo', '.gitea')(filename)
- or nil
+ local dirs_to_check = {
+ '.github/workflows',
+ '.forgejo/workflows',
+ '.gitea/workflows',
+ }
+
+ local dir = vim.fs.dirname(filename)
+ for _, subdir in ipairs(dirs_to_check) do
+ local match = vim.fs.find(subdir, { path = dir, upward = true })[1]
+ if match and vim.fn.isdirectory(match) == 1 and vim.fs.dirname(filename) == match then
+ return match
+ end
+ end
+
+ return nil
end,
-- Disabling "single file support" is a hack to avoid enabling this LS for