| 57 | } |
| 58 | |
| 59 | export class DebugCommands implements IAmDisposable { |
| 60 | protected readonly disposables: IAmDisposable[] = []; |
| 61 | private debugOptions = vs.window.createStatusBarItem("dartStatusDebugOptions", vs.StatusBarAlignment.Left, 0); |
| 62 | public currentDebugOption = DebugOption.MyCode; |
| 63 | private debugMetrics = vs.window.createStatusBarItem("dartStatusDebugMetrics", vs.StatusBarAlignment.Right, 0); |
| 64 | private readonly debugSessionsStatusItem = getLanguageStatusItem("dart.debugSessions", ANALYSIS_FILTERS); |
| 65 | private onWillHotReloadEmitter = new vs.EventEmitter<void>(); |
| 66 | public readonly onWillHotReload = this.onWillHotReloadEmitter.event; |
| 67 | private onWillHotRestartEmitter = new vs.EventEmitter<void>(); |
| 68 | public readonly onWillHotRestart = this.onWillHotRestartEmitter.event; |
| 69 | private onDebugSessionVmServiceAvailableEmitter = new vs.EventEmitter<DartDebugSessionInformation>(); |
| 70 | public readonly onDebugSessionVmServiceAvailable = this.onDebugSessionVmServiceAvailableEmitter.event; |
| 71 | public readonly vmServices: VmServiceExtensions; |
| 72 | private suppressFlutterWidgetErrors = false; |
| 73 | |
| 74 | public isInspectingWidget = false; |
| 75 | private autoCancelNextInspectWidgetMode = false; |
| 76 | |
| 77 | public hasPromptedAboutDebugSettings = false; |
| 78 | |
| 79 | /// The ID of the currently-shown hot reload progress indicator. |
| 80 | private currentHotReloadProgressId: string | undefined; |
| 81 | |
| 82 | /// The ID of the currently-shown hot restart progress indicator. |
| 83 | private currentHotRestartProgressId: string | undefined; |
| 84 | |
| 85 | constructor( |
| 86 | private readonly logger: Logger, |
| 87 | private readonly fileTracker: FileTracker, |
| 88 | private context: Context, |
| 89 | private workspaceContext: DartWorkspaceContext, |
| 90 | readonly dartCapabilities: DartCapabilities, |
| 91 | readonly flutterCapabilities: FlutterCapabilities, |
| 92 | private readonly devTools: DevToolsManager, |
| 93 | private readonly logging: LoggingCommands, |
| 94 | ) { |
| 95 | this.vmServices = new VmServiceExtensions(logger, this, workspaceContext, flutterCapabilities); |
| 96 | this.devTools.debugCommands = this; |
| 97 | this.debugOptions.name = "Dart Debug Options"; |
| 98 | this.disposables.push(this.debugOptions); |
| 99 | this.debugMetrics.name = "Dart Debug Metrics"; |
| 100 | this.disposables.push(this.debugMetrics); |
| 101 | this.debugSessionsStatusItem.name = "Dart Debug Sessions"; |
| 102 | this.updateDebugSessionsStatus(); |
| 103 | |
| 104 | this.disposables.push(vs.debug.onDidChangeBreakpoints((e) => this.handleBreakpointChange(e))); |
| 105 | this.disposables.push(vs.debug.onDidStartDebugSession((s) => this.handleDebugSessionStart(s))); |
| 106 | this.disposables.push(vs.debug.onDidReceiveDebugSessionCustomEvent((e) => this.handleDebugSessionCustomEvent(e))); |
| 107 | this.disposables.push(vs.debug.onDidTerminateDebugSession((s) => this.handleDebugSessionEnd(s))); |
| 108 | this.disposables.push(this.logging.onCaptureLogs((isCapturing) => this.setSendLogsToClient(isCapturing))); |
| 109 | |
| 110 | // Handle enabling Run/Debug buttons for the file if an entry point or have a main() method. |
| 111 | if (this.fileTracker) |
| 112 | this.disposables.push(this.fileTracker.onOutline(() => this.updateRunnableContexts())); |
| 113 | this.disposables.push(vs.window.onDidChangeActiveTextEditor(() => this.updateRunnableContexts())); |
| 114 | // Run for current open editor. |
| 115 | this.updateRunnableContexts(); |
| 116 |
nothing calls this directly
no test coverage detected