Skip to content

Commit

Permalink
Add setting to use either . or & when launching script
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasArona authored and andyleejordan committed Oct 7, 2024
1 parent 5f8a641 commit ba4e3e3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
16 changes: 15 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@
"name": "PowerShell Launch Script",
"type": "PowerShell",
"request": "launch",
"script": "^\"enter path or command to execute e.g.: \\${workspaceFolder}/src/foo.ps1 or Invoke-Pester\"",
"script": "^\"Enter path or command to execute, for example, \\${workspaceFolder}/src/foo.ps1 or Invoke-Pester\"",
"cwd": "^\"\\${cwd}\""
}
},
Expand Down Expand Up @@ -909,6 +909,20 @@
"default": false,
"markdownDescription": "Creates a temporary PowerShell Extension Terminal for each debugging session. This is useful for debugging PowerShell classes and binary modules."
},
"powershell.debugging.executeMode": {
"type": "string",
"enum": [
"DotSource",
"Call"
],
"default": "DotSource",
"markdownEnumDescriptions": [
"Use the Dot-Source operator `.` to launch the script, for example, `. 'C:\\Data\\MyScript.ps1'`",
"Use the Call operator `&` to launch the script, for example, `& 'C:\\Data\\MyScript.ps1'`"
],
"markdownDescription": "Sets the operator used to launch scripts."

},
"powershell.developer.bundledModulesPath": {
"type": "string",
"default": "../../PowerShellEditorServices/module",
Expand Down
1 change: 1 addition & 0 deletions src/features/DebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ export class DebugSessionFeature extends LanguageClientConsumer

const settings = getSettings();
config.createTemporaryIntegratedConsole ??= settings.debugging.createTemporaryIntegratedConsole;
config.executeMode ??= settings.debugging.executeMode;
if (config.request === "attach") {
resolvedConfig = await this.resolveAttachDebugConfiguration(config);
} else if (config.request === "launch") {
Expand Down
6 changes: 6 additions & 0 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ export enum StartLocation {
Panel = "Panel"
}

export enum ExecuteMode{
Call = "Call",
DotSource = "DotSource"
}

export type PowerShellAdditionalExePathSettings = Record<string, string>;

class CodeFormattingSettings extends PartialSettings {
Expand Down Expand Up @@ -107,6 +112,7 @@ class ScriptAnalysisSettings extends PartialSettings {

class DebuggingSettings extends PartialSettings {
createTemporaryIntegratedConsole = false;
executeMode = ExecuteMode.DotSource;
}

class DeveloperSettings extends PartialSettings {
Expand Down

0 comments on commit ba4e3e3

Please sign in to comment.