@@ -23,7 +23,7 @@ import { TelemetryManager } from './managers/TelemetryManager';
2323import { RemoteControlManager } from './managers/RemoteControlManager' ;
2424import { WhatsNewManager } from './managers/WhatsNewManager' ;
2525import type { CustomRequestEvent } from 'roku-debug' ;
26- import { isChannelPublishedEvent , isChanperfEvent , isDiagnosticsEvent , isDebugServerLogOutputEvent , isLaunchStartEvent , isRendezvousEvent , isCustomRequestEvent , isExecuteTaskCustomRequest , ClientToServerCustomEventName } from 'roku-debug' ;
26+ import { isChannelPublishedEvent , isChanperfEvent , isDiagnosticsEvent , isDebugServerLogOutputEvent , isLaunchStartEvent , isRendezvousEvent , isCustomRequestEvent , isExecuteTaskCustomRequest , ClientToServerCustomEventName , isShowPopupMessageCustomRequest } from 'roku-debug' ;
2727import { RtaManager } from './managers/RtaManager' ;
2828import { WebviewViewProviderManager } from './managers/WebviewViewProviderManager' ;
2929import { ViewProviderId } from './viewProviders/ViewProviderId' ;
@@ -204,10 +204,6 @@ export class Extension {
204204 this . diagnosticManager . clear ( ) ;
205205 } ) ;
206206
207- vscode . debug . onDidReceiveDebugSessionCustomEvent ( async ( e ) => {
208- await logOutputManager . onDidReceiveDebugSessionCustomEvent ( e ) ;
209- } ) ;
210-
211207 let brightscriptConfig = vscode . workspace . getConfiguration ( 'brightscript' ) ;
212208 if ( brightscriptConfig ?. outputPanelStartupBehavior ) {
213209 if ( brightscriptConfig . outputPanelStartupBehavior === 'show' ) {
@@ -232,6 +228,7 @@ export class Extension {
232228 }
233229
234230 private async debugSessionCustomEventHandler ( e : vscode . DebugSessionCustomEvent , context : vscode . ExtensionContext , docLinkProvider : LogDocumentLinkProvider , logOutputManager : LogOutputManager , rendezvousViewProvider : RendezvousViewProvider ) {
231+
235232 if ( isLaunchStartEvent ( e ) ) {
236233 const config = e . body as BrightScriptLaunchConfiguration ;
237234 await docLinkProvider . setLaunchConfig ( config ) ;
@@ -287,19 +284,40 @@ export class Extension {
287284 }
288285 }
289286 }
287+
288+ try {
289+ await logOutputManager . onDidReceiveDebugSessionCustomEvent ( e ) ;
290+ } catch ( err ) {
291+ console . error ( 'Error handling custom event' , e , err ) ;
292+ }
293+ }
294+
295+ private async showMessage ( e : any ) {
296+ const methods = {
297+ error : vscode . window . showErrorMessage ,
298+ info : vscode . window . showInformationMessage ,
299+ warn : vscode . window . showWarningMessage
300+ } ;
301+ return {
302+ selectedAction : await Promise . resolve ( methods [ e . body . severity ] ( e . body . message , { modal : e . body . modal } , ...e . body . actions ) )
303+ } ;
290304 }
291305
292306 private async processCustomRequestEvent ( event : CustomRequestEvent , session : vscode . DebugSession ) {
293307 try {
294308 let response : any ;
295309 if ( isExecuteTaskCustomRequest ( event ) ) {
296310 response = await this . executeTask ( event . body . task ) ;
311+ } else if ( isShowPopupMessageCustomRequest ( event ) ) {
312+ response = await this . showMessage ( event ) ;
297313 }
314+ //send the response back to the server
298315 await session . customRequest ( ClientToServerCustomEventName . customRequestEventResponse , {
299316 requestId : event . body . requestId ,
300317 ...response ?? { }
301318 } ) ;
302319 } catch ( e ) {
320+ //send the error back to the server
303321 await session . customRequest ( ClientToServerCustomEventName . customRequestEventResponse , {
304322 requestId : e . body . requestId ,
305323 error : {
0 commit comments