Skip to content

Add setting to use either . or & when launching script #5059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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