-
Notifications
You must be signed in to change notification settings - Fork 522
Description
Prerequisites
- I have written a descriptive issue title.
- I have searched all open and closed issues to ensure it has not already been reported.
- I have read the troubleshooting guide.
- I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
- If this is a security issue, I have read the security issue reporting guidance.
Summary
The description for the powershell.cwd setting says:
Predefined variables can be used (i.e. ${fileDirname} to use the current opened file's directory).
However, even if a predefined variable (e.g., ${fileDirname} or ${fileWorkspaceFolder}) is used for powershell.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:
Select a folder to use as the PowerShell extension's 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:
{
"powershell.startAutomatically": true,
"powershell.integratedConsole.showOnStartup": false,
"powershell.integratedConsole.startInBackground": true
}Possibly related code:
vscode-powershell/src/settings.ts
Lines 326 to 331 in c3c857d
| let cwd: string = vscode.workspace.getConfiguration(utils.PowerShellLanguageId).get<string>("cwd", undefined); | |
| // Only use the cwd setting if it exists. | |
| if (await utils.checkIfDirectoryExists(cwd)) { | |
| return cwd; | |
| } |
PowerShell Version
Name Value
---- -----
PSVersion 7.2.6
PSEdition Core
GitCommitId 7.2.6
OS Microsoft Windows 10.0.22000
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Visual Studio Code Version
1.71.0
784b0177c56c607789f9638da7b6bf3230d47a8c
x64Extension Version
ms-vscode.powershell@2022.8.5Steps to Reproduce
- Apply the following settings:
where any other predefined variable (e.g.,
{ "powershell.cwd": "${fileWorkspaceFolder}", "powershell.startAutomatically": true, "powershell.integratedConsole.showOnStartup": false, "powershell.integratedConsole.startInBackground": true }${fileDirname}) can be used forpowershell.cwd. - Open a multi-root workspace in a new VS Code window.
- Open a PowerShell (.ps1) file, and the workspace folder pick will pop up.
Visuals
No response
Logs
No response