vscode-shell-command
vscode-shell-command copied to clipboard
Cannot use cwd to workspaceFolder where task is defined unless specified by index
Hello,
When cwd is set to "${workspaceFolder}", then command is executed in first workspace folder. I want command to be executed in workspace folder where it is defined so I had to use "${workspaceFolder[8]}". This is not convenient and if this index change then task may fail.
Can you change so "${workspaceFolder}" would point to workspace folder where task is defined? Or perhaps add possibility to select workspace folder by name?
I believe this happens when you have multi folder workspace right? I haven't tested this use case and as you can see here I'm not parsing the indexes from workspacefolders. It's a nice to have. If you wanna help with a PR would be awesome, otherwise I have to see when I'll have time to do it.
Can you support multi folder workspace variable reference in cwd as described here
Is this on the roadmap at some point? multi-root workspaces have become very common and VSCode leaves it to the extension developers to support it
@rahul0705 every open issue is on the roadmap to be implemented at some point. At the moment I don't have much time to focus on it because of personal and work related stuff, but I'm always reviewing PRs when they arise. So if it is very important to you I'd suggest you to give it a try an open a PR.
Hi I'm also facing this problem, I'm working in a multi-root workspace, and this extension always takes the first folder. This is not convenient to share tasks among team members, which have their own workspace.
@cat-anna @Satheeshkumar-Duraisamy @rahul0705 @axel-lebourhis
I have implemented a prototype of this feature in this branch: https://github.com/MarcelRobitaille/vscode-shell-command-ngx/tree/feature/multi_workspace. Please let me know if it works for you.
It should resolve ${workspaceFolder}
to the folder in which the task you ran is defined. ${workspaceFolder[x]}
should work the same as before.
Does yours also take into account the ${workspaceFolder:<name>}
syntax?
@vindicatorr no. I will try to implement that
@MarcelRobitaille Kudos for you for working on this. Sadly I no longer use this plugin.
@cat-anna Thanks :smile: May I ask if you switched to something else or simply don't use anything similar to this? If it's the former, maybe there's something we could do to improve this plugin.
@vindicatorr as of 08aa49c8bfca478aeb8737471b8b858f07ee529a it does :wink:
Can confirm that the ${workspaceFolder:<name>}
syntax does work now.
Previously: "cwd": "${workspaceFolder[<#>]}",
Currently (previously failed): "cwd": "${workspaceFolder:<name, even with spaces>}",
@vindicatorr Thanks for checking. Do you (also the others) who actually use multiple folders think there's something more to do in this area before I open a PR for this?
Not specific to the workspaceFolder usage: https://github.com/augustocdias/vscode-shell-command/pull/19#issuecomment-1902904006 (actually, that would be a separate/unrelated PR. Dunno if I should open an issue on it, or my comment in the PR is good enough)
@MarcelRobitaille My workflow changed and I don't need plugin like this at all.