-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
fix(gh_actions_ls): Fix incorrect rootdir resolution #3573
base: master
Are you sure you want to change the base?
Conversation
@justinmk |
7438c59
to
f4e0fff
Compare
|
||
for _, entry in ipairs(patterns) do | ||
if filename:find(entry.pattern) then | ||
local match = vim.fs.find(entry.root, { path = filename, upward = true })[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use vim.fs.dirname
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like this ?
diff --git a/lua/lspconfig/configs/gh_actions_ls.lua b/lua/lspconfig/configs/gh_actions_ls.lua
index 9ea39b85..ebd48f60 100644
--- a/lua/lspconfig/configs/gh_actions_ls.lua
+++ b/lua/lspconfig/configs/gh_actions_ls.lua
@@ -15,7 +15,8 @@ return {
for _, entry in ipairs(patterns) do
if filename:find(entry.pattern) then
- local match = vim.fs.find(entry.root, { path = filename, upward = true })[1]
+ local dir = vim.fs.dirname(filename)
+ local match = vim.fs.find(entry.root, { path = dir, upward = true })[1]
if match then
return match
end
What do you want me to replace ?
EDIT:
Or dont you like any filename:
?
I could o something like this
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
What exactly is the regression? When I test out gh_actions on master it seems to work for me. |
What repo/file are you testing? I'd like to test it. |
Take that one for instance https://github.com/Crashdummyy/roslynLanguageServer.git |
OK, you're right, I can recreate the problem. Thanks. Let me take a look at the code. |
Does the following work? I tried it and autocompletion worked for me root_dir = require('lspconfig.util').root_pattern('.github/workflows', '.forgejo/workflows', '.gitea/workflows'), |
Tested that one as well. When I open any other random file it tries to attach as well. EDIT: # should be detected
.
├──.github
│ └── workflows
│ ├── CreateSnapshot.yml
│ ├── dotnet.yml
│ ├── loadtests.yml
│ ├── release.yml
│ ├── RestoreSnapshot.yml
│ └── tenantconfigs
│ └── action.yml
│
├── cmiLoadTestSchema.yml # should not be detected
|
Yes, but then I said in #3573 (comment) that because of reasons we can still use root_pattern. The current approach of vim.fs.dirname(... is also fine. |
Oh sorry I misread that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, this works for me. There might be an easier way to achieve this but eh
Regression of #3566