import { DebugAdapterTracker , DebugConsole , DebugSession } from "vscode" ; import { DebuggerCommunicationService } from "../service/debuggerCommunicationService" ; import { MessagingService } from "../service/messagingService" ; import { DEBUG_COMMANDS } from "../view/constants" ; export class DebugAdapter implements DebugAdapterTracker { private readonly console : DebugConsole | undefined ; private readonly messagingService : MessagingService ; private debugCommunicationService : DebuggerCommunicationService ; constructor ( debugSession , messagingService , debugCommunicationService ) { this . console = debugSession . configuration . console ; this . messagingService = messagingService ; this . debugCommunicationService = debugCommunicationService ; } onWillStartSession ( ) { } onWillReceiveMessage ( message ) { if ( message . command ) { switch ( message . command ) { case DEBUG_COMMANDS . CONTINUE : this . messagingService . sendStartMessage ( ) ; break ; case DEBUG_COMMANDS . STACK_TRACE : this . messagingService . sendPauseMessage ( ) ; break ; case DEBUG_COMMANDS . DISCONNECT : if ( ! message . arguments . restart ) { this . debugCommunicationService . handleStopEvent ( ) ; } break ; } } } onError ( ) { this . messagingService . sendStartMessage ( ) ; } onExit ( ) { this . messagingService . sendStartMessage ( ) ; } }