Skip to content

Commit aa1c300

Browse files
authored
Add setting to change the cwd of the Powershell Integrated Console (#2796)
* Add setting to change the cwd of the Powershell Integrated Console * Changet setting from powershell.integratedConsole.cwd to powershell.cwd * pwsh location for opened folders must be solved in PSES
1 parent f09572c commit aa1c300

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,11 @@
640640
"default": "BlockComment",
641641
"description": "Controls the comment-based help completion behavior triggered by typing '##'. Set the generated help style with 'BlockComment' or 'LineComment'. Disable the feature with 'Disabled'."
642642
},
643+
"powershell.cwd": {
644+
"type": "string",
645+
"default": null,
646+
"description": "An explicit start path where the Powershell Integrated Console will be launched. Both the PowerShell process and the shell's location will be set to this directory. Predefined variables can be used (i.e. ${fileDirname} to use the current opened file's directory)."
647+
},
643648
"powershell.scriptAnalysis.enable": {
644649
"type": "boolean",
645650
"default": true,

src/process.ts

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ export class PowerShellProcess {
112112
shellPath: this.exePath,
113113
shellArgs: powerShellArgs,
114114
hideFromUser: !this.sessionSettings.integratedConsole.showOnStartup,
115+
cwd: this.sessionSettings.cwd
115116
});
116117

117118
const pwshName = path.basename(this.exePath);

src/settings.ts

+3
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export interface ISettings {
101101
sideBar?: ISideBarSettings;
102102
pester?: IPesterSettings;
103103
buttons?: IButtonSettings;
104+
cwd?: string;
104105
}
105106

106107
export interface IStartAsLoginShellSettings {
@@ -257,6 +258,8 @@ export function load(): ISettings {
257258
// is the reason terminals on macOS typically run login shells by default which set up
258259
// the environment. See http://unix.stackexchange.com/a/119675/115410"
259260
configuration.get<IStartAsLoginShellSettings>("startAsLoginShell", defaultStartAsLoginShellSettings),
261+
cwd:
262+
configuration.get<string>("cwd", null),
260263
};
261264
}
262265

0 commit comments

Comments
 (0)