Skip to content

Commit c603269

Browse files
committed
Add a setting to launch scripts with the Call operator instead of the DotSource operator
Add support to switch the ExecuteMode from DotSource to Call
1 parent efd6fd5 commit c603269

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

package.json

+14
Original file line numberDiff line numberDiff line change
@@ -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 (e.g.: . 'C:\\Data\\MyScript.ps1')",
921+
"Use the Call operator to launch the script (e.g.: & '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)