Skip to content

Commit 0c21bb6

Browse files
committed
Use named debug configurations instead of duplicating them
Now that we have a record of debug configurations we can fix these TODOs.
1 parent 14961fa commit 0c21bb6

File tree

3 files changed

+4
-16
lines changed

3 files changed

+4
-16
lines changed

src/features/DebugSession.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,7 @@ export class DebugSessionFeature extends LanguageClientConsumer
150150
this.handlers = [
151151
languageClient.onNotification(
152152
StartDebuggerNotificationType,
153-
// TODO: Use a named debug configuration.
154-
() => void debug.startDebugging(undefined, {
155-
request: "launch",
156-
type: "PowerShell",
157-
name: "PowerShell: Interactive Session"
158-
})),
153+
() => void debug.startDebugging(undefined, defaultDebugConfigurations[DebugConfig.InteractiveSession])),
159154

160155
languageClient.onNotification(
161156
StopDebuggerNotificationType,
@@ -401,7 +396,7 @@ export class DebugSessionFeature extends LanguageClientConsumer
401396
});
402397

403398
// Start a child debug session to attach the dotnet debugger
404-
// TODO: Accomodate multi-folder workspaces if the C# code is in a different workspace folder
399+
// TODO: Accommodate multi-folder workspaces if the C# code is in a different workspace folder
405400
await debug.startDebugging(undefined, dotnetAttachConfig, session);
406401
this.logger.writeVerbose(`Dotnet Attach Debug configuration: ${JSON.stringify(dotnetAttachConfig)}`);
407402
this.logger.write(`Attached dotnet debugger to process ${pid}`);
@@ -754,4 +749,3 @@ export class PickRunspaceFeature extends LanguageClientConsumer {
754749
this.waitingForClientToken = undefined;
755750
}
756751
}
757-

src/features/ExtensionCommands.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { LanguageClient } from "vscode-languageclient/node";
1212
import { ILogger } from "../logging";
1313
import { getSettings, validateCwdSetting } from "../settings";
1414
import { LanguageClientConsumer } from "../languageClientConsumer";
15+
import { DebugConfig, defaultDebugConfigurations } from "./DebugSession";
1516

1617
export interface IExtensionCommand {
1718
name: string;
@@ -187,13 +188,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
187188

188189
vscode.commands.registerCommand("PowerShell.Debug.Start",
189190
async () => {
190-
// TODO: Use a named debug configuration.
191-
await vscode.debug.startDebugging(undefined, {
192-
name: "PowerShell: Launch Current File",
193-
type: "PowerShell",
194-
request: "launch",
195-
script: "${file}",
196-
});
191+
await vscode.debug.startDebugging(undefined, defaultDebugConfigurations[DebugConfig.LaunchCurrentFile]);
197192
})
198193
];
199194
}

src/features/ISECompatibility.ts

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export class ISECompatibilityFeature implements vscode.Disposable {
3232
private _originalSettings: Record<string, boolean | string | undefined> = {};
3333

3434
constructor() {
35-
// TODO: This test isn't great.
3635
const testSetting = ISECompatibilityFeature.settings[ISECompatibilityFeature.settings.length - 1];
3736
this._iseModeEnabled = vscode.workspace.getConfiguration(testSetting.path).get(testSetting.name) === testSetting.value;
3837
this._commandRegistrations = [

0 commit comments

Comments
 (0)