Skip to content

Commit 78f3a36

Browse files
Add setting to use either . or & when launching script (#5059)
Co-authored-by: LucasArona <[email protected]>
1 parent 35cbd00 commit 78f3a36

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

package.json

+15-1
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@
462462
"name": "PowerShell Launch Script",
463463
"type": "PowerShell",
464464
"request": "launch",
465-
"script": "^\"enter path or command to execute e.g.: \\${workspaceFolder}/src/foo.ps1 or Invoke-Pester\"",
465+
"script": "^\"Enter path or command to execute, for example, \\${workspaceFolder}/src/foo.ps1 or Invoke-Pester\"",
466466
"cwd": "^\"\\${cwd}\""
467467
}
468468
},
@@ -909,6 +909,20 @@
909909
"default": false,
910910
"markdownDescription": "Creates a temporary PowerShell Extension Terminal for each debugging session. This is useful for debugging PowerShell classes and binary modules."
911911
},
912+
"powershell.debugging.executeMode": {
913+
"type": "string",
914+
"enum": [
915+
"DotSource",
916+
"Call"
917+
],
918+
"default": "DotSource",
919+
"markdownEnumDescriptions": [
920+
"Use the Dot-Source operator `.` to launch the script, for example, `. 'C:\\Data\\MyScript.ps1'`",
921+
"Use the Call operator `&` to launch the script, for example, `& 'C:\\Data\\MyScript.ps1'`"
922+
],
923+
"markdownDescription": "Sets the operator used to launch scripts."
924+
925+
},
912926
"powershell.developer.bundledModulesPath": {
913927
"type": "string",
914928
"default": "../../PowerShellEditorServices/module",

src/features/DebugSession.ts

+1
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ export class DebugSessionFeature extends LanguageClientConsumer
290290

291291
const settings = getSettings();
292292
config.createTemporaryIntegratedConsole ??= settings.debugging.createTemporaryIntegratedConsole;
293+
config.executeMode ??= settings.debugging.executeMode;
293294
if (config.request === "attach") {
294295
resolvedConfig = await this.resolveAttachDebugConfiguration(config);
295296
} else if (config.request === "launch") {

src/settings.ts

+6
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ export enum StartLocation {
7676
Panel = "Panel"
7777
}
7878

79+
export enum ExecuteMode{
80+
Call = "Call",
81+
DotSource = "DotSource"
82+
}
83+
7984
export type PowerShellAdditionalExePathSettings = Record<string, string>;
8085

8186
class CodeFormattingSettings extends PartialSettings {
@@ -107,6 +112,7 @@ class ScriptAnalysisSettings extends PartialSettings {
107112

108113
class DebuggingSettings extends PartialSettings {
109114
createTemporaryIntegratedConsole = false;
115+
executeMode = ExecuteMode.DotSource;
110116
}
111117

112118
class DeveloperSettings extends PartialSettings {

0 commit comments

Comments
 (0)