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

workspaceFolder in a multi-root workspace #79

Open
dyitzchaki-roku opened this issue Feb 9, 2024 · 3 comments
Open

workspaceFolder in a multi-root workspace #79

dyitzchaki-roku opened this issue Feb 9, 2024 · 3 comments

Comments

@dyitzchaki-roku
Copy link

dyitzchaki-roku commented Feb 9, 2024

The value of ${workspaceFolder} is expanded differently by the extension than how VSCode expands it.
Outside the extension,

It doesn't return the workspace folder the currently active file is in. It returns the workspace folder in which the task is defined
microsoft/vscode#54596 (comment)

Personally I find the way VSCode expands it is more useful.
IMO it can also be used for resolving nested ${input} variables

The fact that I do not support the ${input} variable is that I don't know which .json is the source of the command (task, launch, keybindings).
#45 (comment)

@rioj7
Copy link
Owner

rioj7 commented Feb 10, 2024

@dyitzchaki-roku Like the comment from #45, I don't have the information that VSC has, VSC calls my command and I have no clue where it is called from. If you want the workspace folder where the task is defined you should use ${workspaceFolder:name}. Where name is the name of that workspace, as mentioned in the vscode issue 54596

@dyitzchaki-roku
Copy link
Author

Maybe workspaceFolder should be renamed to fileWorkspaceFolder then

${fileWorkspaceFolder} - the current opened file's workspace folder

https://code.visualstudio.com/docs/editor/variables-reference#_predefined-variables

@rioj7
Copy link
Owner

rioj7 commented Feb 14, 2024

@dyitzchaki-roku I can add this new variable as a synonym, because I can't supply the behavior of VSC. I might make an educated guess by analyzing all tasks.json and launch.json files and try to find the input entry used. But the simple method is to also name the workspace in the task input var used. What to do with the global defined tasks, they are not part of a workspace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants