-
Notifications
You must be signed in to change notification settings - Fork 36.5k
Description
This was covered a little bit in #94153 but that issue is locked and can't be discussed there. This feature feels pretty broken on macOS and I hope might be revisited.
The issue is on macOS prepending to PATH:
context.environmentVariableCollection.prepend("PATH", "/foo/my/path:");
This ends up being added to the end of the path, rather than the start. @Tyriar wrote up why this is in microsoft/vscode-docs@38653d4 and offered two workarounds, however neither of them are usable in my testing (as well as not really being feasible to tell all users to change):
"terminal.integrated.inheritEnv": falsemakes no difference at all, the PATH till is added to the end (this is a problem because the purpose of usingprependabove is that we need to override any existing SDK on PATH with the one the user just selected)"terminal.integrated.shellArgs": []results in a completely emptyPATHbesides the values I've prepended, which means that pretty much everything else is missing and won't work. This might be solvable by pushingprocess.env.PATHintoenvironmentVariableCollectiontoo, however the prompt to the user would look ridiculous as it would include their entire PATH
I appreciate this probably isn't VS Code's fault, but given macOS is fairly common and this behaviour seems to happen on a clean macOS install (it happens on both of mine, and I've customised almost nothing) it feels like it's worth trying to fix (maybe even if it means sending export PATH=foo:$PATH once the shell is initialised? 😄).