From a25bd9da754cb35917e557ad8744cfd7956ccdbe Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 17 May 2017 14:31:44 -0700 Subject: [PATCH] Debugger is now activated when breakpoints are hit in Integrated Console This change adds new behavior which causes VS Code's debugger UI to be activated when a breakpoint is hit in the Integrated Console while not currently in debug mode. This allows the user to set breakpoints and run scripts from the console while still leveraging VS Code's rich debugging UI. Resolves #619. --- src/features/DebugSession.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/features/DebugSession.ts b/src/features/DebugSession.ts index e687615a8c..75b65bf12a 100644 --- a/src/features/DebugSession.ts +++ b/src/features/DebugSession.ts @@ -8,6 +8,10 @@ import { IFeature } from '../feature'; import { SessionManager } from '../session'; import { LanguageClient, RequestType, NotificationType } from 'vscode-languageclient'; +export namespace StartDebuggerNotification { + export const type = new NotificationType('powerShell/startDebugger'); +} + export class DebugSessionFeature implements IFeature { private command: vscode.Disposable; private examplesPath: string; @@ -18,7 +22,14 @@ export class DebugSessionFeature implements IFeature { config => { this.startDebugSession(config); }); } - public setLanguageClient(languageclient: LanguageClient) { + public setLanguageClient(languageClient: LanguageClient) { + languageClient.onNotification( + StartDebuggerNotification.type, + none => this.startDebugSession({ + request: 'launch', + type: 'PowerShell', + name: 'PowerShell Interactive Session' + })); } public dispose() {