Skip to content

Commit 98f2b44

Browse files
committed
Use built-in DebugAdapterNamedPipeServer and small clean-ups
1 parent 8c80df6 commit 98f2b44

File tree

3 files changed

+14
-141
lines changed

3 files changed

+14
-141
lines changed

src/debugAdapter.ts

-119
This file was deleted.

src/features/DebugSession.ts

+10-18
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { PowerShellProcess} from "../process";
1111
import { SessionManager, SessionStatus } from "../session";
1212
import Settings = require("../settings");
1313
import utils = require("../utils");
14-
import { NamedPipeDebugAdapter } from "../debugAdapter";
1514
import { Logger } from "../logging";
1615
import { LanguageClientConsumer } from "../languageClientConsumer";
1716

@@ -37,20 +36,16 @@ export class DebugSessionFeature extends LanguageClientConsumer
3736

3837
createDebugAdapterDescriptor(
3938
session: vscode.DebugSession,
40-
_executable: vscode.DebugAdapterExecutable): vscode.ProviderResult<vscode.DebugAdapterDescriptor> {
39+
_executable: vscode.DebugAdapterExecutable | undefined): vscode.ProviderResult<vscode.DebugAdapterDescriptor> {
4140

4241
const sessionDetails = session.configuration.createTemporaryIntegratedConsole
4342
? this.tempSessionDetails
4443
: this.sessionManager.getSessionDetails();
4544

46-
// Establish connection before setting up the session
4745
this.logger.writeVerbose(`Connecting to pipe: ${sessionDetails.debugServicePipeName}`);
4846
this.logger.writeVerbose(`Debug configuration: ${JSON.stringify(session.configuration)}`);
4947

50-
const debugAdapter = new NamedPipeDebugAdapter(sessionDetails.debugServicePipeName, this.logger);
51-
debugAdapter.start();
52-
53-
return new vscode.DebugAdapterInlineImplementation(debugAdapter);
48+
return new vscode.DebugAdapterNamedPipeServer(sessionDetails.debugServicePipeName);
5449
}
5550

5651
// tslint:disable-next-line:no-empty
@@ -60,19 +55,16 @@ export class DebugSessionFeature extends LanguageClientConsumer
6055
public setLanguageClient(languageClient: LanguageClient) {
6156
languageClient.onNotification(
6257
StartDebuggerNotificationType,
63-
() =>
64-
// TODO: Use a named debug configuration.
65-
vscode.debug.startDebugging(undefined, {
66-
request: "launch",
67-
type: "PowerShell",
68-
name: "PowerShell: Interactive Session",
69-
}));
58+
// TODO: Use a named debug configuration.
59+
() => vscode.debug.startDebugging(undefined, {
60+
request: "launch",
61+
type: "PowerShell",
62+
name: "PowerShell: Interactive Session"
63+
}));
7064

7165
languageClient.onNotification(
7266
StopDebuggerNotificationType,
73-
() =>
74-
vscode.debug.stopDebugging(undefined)
75-
);
67+
() => vscode.debug.stopDebugging(undefined));
7668
}
7769

7870
public async provideDebugConfigurations(
@@ -374,7 +366,7 @@ export class SpecifyScriptArgsFeature implements vscode.Disposable {
374366

375367
const text = await vscode.window.showInputBox(options);
376368
// When user cancel's the input box (by pressing Esc), the text value is undefined.
377-
// Let's not blow away the previous settting.
369+
// Let's not blow away the previous setting.
378370
if (text !== undefined) {
379371
this.context.workspaceState.update(powerShellDbgScriptArgsKey, text);
380372
}

src/session.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ export enum SessionStatus {
3434
Failed,
3535
}
3636

37-
export const SendKeyPressNotificationType =
38-
new NotificationType<void>("powerShell/sendKeyPress");
39-
4037
export class SessionManager implements Middleware {
4138
public HostName: string;
4239
public HostVersion: string;
@@ -797,7 +794,7 @@ export class SessionManager implements Middleware {
797794
new SessionMenuItem(
798795
"Restart Current Session",
799796
() => {
800-
// We pass in the display name so we guarentee that the session
797+
// We pass in the display name so we guarantee that the session
801798
// will be the same PowerShell.
802799
this.restartSession(this.PowerShellExeDetails.displayName);
803800
}),
@@ -828,6 +825,9 @@ class SessionMenuItem implements vscode.QuickPickItem {
828825
}
829826
}
830827

828+
export const SendKeyPressNotificationType =
829+
new NotificationType<void>("powerShell/sendKeyPress");
830+
831831
export const PowerShellVersionRequestType =
832832
new RequestType0<IPowerShellVersionDetails, void>(
833833
"powerShell/getVersion");

0 commit comments

Comments
 (0)