vscode-shell-command icon indicating copy to clipboard operation
vscode-shell-command copied to clipboard

Cannot use cwd to workspaceFolder where task is defined unless specified by index

Open cat-anna opened this issue 5 years ago • 4 comments

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?

cat-anna avatar Dec 11 '19 08:12 cat-anna

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.

augustocdias avatar Dec 11 '19 09:12 augustocdias

Can you support multi folder workspace variable reference in cwd as described here

Satheeshkumar-Duraisamy avatar Mar 15 '21 16:03 Satheeshkumar-Duraisamy

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 avatar Apr 18 '22 17:04 rahul0705

@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.

augustocdias avatar Apr 19 '22 12:04 augustocdias

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.

axel-lebourhis avatar Mar 21 '23 15:03 axel-lebourhis

@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.

MarcelRobitaille avatar Jan 22 '24 22:01 MarcelRobitaille

Does yours also take into account the ${workspaceFolder:<name>} syntax?

vindicatorr avatar Jan 23 '24 03:01 vindicatorr

@vindicatorr no. I will try to implement that

MarcelRobitaille avatar Jan 23 '24 07:01 MarcelRobitaille

@MarcelRobitaille Kudos for you for working on this. Sadly I no longer use this plugin.

cat-anna avatar Jan 23 '24 08:01 cat-anna

@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.

MarcelRobitaille avatar Jan 23 '24 20:01 MarcelRobitaille

@vindicatorr as of 08aa49c8bfca478aeb8737471b8b858f07ee529a it does :wink:

MarcelRobitaille avatar Jan 23 '24 20:01 MarcelRobitaille

Can confirm that the ${workspaceFolder:<name>} syntax does work now. Previously: "cwd": "${workspaceFolder[<#>]}", Currently (previously failed): "cwd": "${workspaceFolder:<name, even with spaces>}",

vindicatorr avatar Jan 23 '24 22:01 vindicatorr

@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?

MarcelRobitaille avatar Jan 23 '24 22:01 MarcelRobitaille

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)

vindicatorr avatar Jan 23 '24 22:01 vindicatorr

@MarcelRobitaille My workflow changed and I don't need plugin like this at all.

cat-anna avatar Jan 24 '24 08:01 cat-anna