-
-
Notifications
You must be signed in to change notification settings - Fork 334
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
[VS Code] Cannot use scoped workspace folder variables in multiroot workspaces to define paths #2987
Comments
I just come across some usage of multi-root workspace in vscode. https://code.visualstudio.com/docs/editor/variables-reference
A vscode ticket is tracking this feature request: microsoft/vscode#44755 In short, variable substitution is the responsibility of vscode instead of luals, and seems it is unsupported right now |
I think the feature request is more related to this ticket: microsoft/vscode#2809. I doubt this feature will ever be implemented, as there have already been attempts at pull requests, and one of the reasons for rejection is that it breaks existing functionality. Many plugins already handle variable resolution on their own. Would it be acceptable to implement variable resolution in luals? |
(First thing first, I am not maintainer, so my understanding may not be fully correct.) There is already a limited variable resolution in luals, in particular the I tried to create a dummy workspace json with content similar to to above example: {
"folders": [
{
"name": "root",
"path": "."
},
{
"name": "client",
"path": "client"
},
{
"name": "server",
"path": "server"
}
],
"settings": {
"Lua.workspace.library": [
"${workspaceFolder:client}",
]
}
} and from the luals log file, the client has sent the followings to server: workspaceFolders = { {
name = "root",
uri = "file:///c%3A/Users/TomLau/test"
}, {
name = "client",
uri = "file:///c%3A/Users/TomLau/test/client"
}, {
name = "server",
uri = "file:///c%3A/Users/TomLau/test/server"
} } => so I believe it is possible for luals to know the mapping between workspace names and paths And finally we have to add some extra resolution logic here: lua-language-server/script/files.lua Lines 945 to 948 in cb964c6
(some more elseif I believe)
|
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Linux
What is the issue affecting?
Other
Expected Behaviour
It should be possible to configure the
Lua.runtime.path
andLua.workspace.library
, and other file path related options in a multi-root workspace using scoped workspace folder variables.Additional Information
Take the following multi-root workspace JSON, for example:
We have two projects in two totally different directory trees that are part of the same workspace, one of which is a "library".
Furthermore, let's assume that the workspace
.json
file is in a completely separate, third directory tree.VS Code provides workspace folder scoping via the syntax
${workspaceFolder:}
and the value in thename
field after the colon (or thebasename
of the path as a fallback).Given all of this, I would expect to be able to do the following:
However, this doesn't seem to work; the only way to work around this is to use absolute paths for the language server configurations.
Actual Behaviour
Files that should be resolved at
require
time in the referenced directories are not resolved when workspace folder scoped variables are usedReproduction steps
See the context/explanation in
Expected Behavior
Additional Notes
No response
Log File
No response
The text was updated successfully, but these errors were encountered: