-
Notifications
You must be signed in to change notification settings - Fork 60
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
Find workspace root #247
Find workspace root #247
Conversation
…ory for one of the project root files. The default list of project root files was copied from codeium.vim.
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.
Thanks for this PR, definitely the existing relative path wasn't computed correctly. The workspace_uri
argument is expected to be file:///path/to/workspace
(convention changed from relative path to the other path components basically) just like theabsolute_uri
argument is expected to be file:///path/to/workspace/foo/bar.txt
.
lua/codeium/util.lua
Outdated
end | ||
|
||
-- From the CWD, walk up the tree looking for a directory that contains one of the project root files | ||
local candidates = config.options.project_root_paths |
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.
Maybe the source of candidates should be vim.lsp.buf.list_workspace_folders()
?
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.
That seems like a good idea. Personally I'm actually still on coc.nvim so I'll probably keep the project_root_paths option as a fallback when list_workspace_folders
returns nothing.
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.
Sounds reasonable.
-- From the CWD, walk up the tree looking for a directory that contains one of the project root files | ||
local candidates = config.options.workspace_root.paths | ||
local result = vim.fs.find(candidates, { | ||
path = cwd, |
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.
@dimfeld where is this cwd variable coming from? I notice that this pr fixed things for mac, but on windows it fails. Seems the failure is because this cwd variable is nil. How does it get populated on mac?
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.
Ah sorry, that was missed when I was moving around some code. M.get_project_root
should pass its wd
variable to _get_project_root
for the value of cwd
.
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.
Submitted #248 as a fix
This provides a few methods of finding the workspace root (see comment below) and updates the calls that use
workspace_uri
to use it.Closes #244
Closes #238
Supersedes #243