-
Notifications
You must be signed in to change notification settings - Fork 511
Workspace folder pick pops up if a predefined variable is used for the powershell.cwd
setting
#4163
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
Comments
Hm, I'll have to check when the pre-defined variable is getting interpolated. |
@lewis-yeung can you confirm that this used to work as you expected in a prior version of the extension? |
I actually can't imagine that |
@andschwa In fact, the problem can arise with all predefined variables. I've tested
Or worst, if a predefined variable is not designed to be used here at all, the following description should be adjusted since it's really misleading, IMO. vscode-powershell/package.json Line 647 in 60af2ce
|
@andschwa I can confirm that v2022.6.3 works fine, even I don't customize
which is related to #4064. |
I don't think that v2022.6.3 worked as you expected. While I believe that there was no error being thrown, I think the given value was still not having the predefined variables resolved. In that version, this was a silent error and the value was just passed along unvalidated, and the server ignored it since it wasn't a proper path. In the latest version, the setting is now validated and an error thrown. Unfortunately, VS Code has yet to provide an API for extension's to resolve their pre-defined variables in our contributed settings: microsoft/vscode#46471 Until that API is available, this sadly isn't something we can support. I don't know why the existing setting says it was ever supported; that must just be a historical error. The best I can do right now is update |
Prerequisites
Summary
The description for the
powershell.cwd
setting says:However, even if a predefined variable (e.g.,
${fileDirname}
or${fileWorkspaceFolder}
) is used forpowershell.cwd
, whenever I open a PowerShell (.ps1) file in a multi-root workspace for the first time, it prompts me to choose a workspace folder as the working directory:This is so annoying and should not happen. While if I use a literal path such as
C:\
, it works fine and the workspace folder pick does not pop up.Other possibly related settings I use:
Possibly related code:
vscode-powershell/src/settings.ts
Lines 326 to 331 in c3c857d
PowerShell Version
Visual Studio Code Version
Extension Version
[email protected]
Steps to Reproduce
${fileDirname}
) can be used forpowershell.cwd
.Visuals
No response
Logs
No response
The text was updated successfully, but these errors were encountered: