( context: vscode.ExtensionContext, debugSessionTracker: DebugSessionTracker, )
| 343 | } |
| 344 | |
| 345 | export function registerCustomBreakpointsUI( |
| 346 | context: vscode.ExtensionContext, |
| 347 | debugSessionTracker: DebugSessionTracker, |
| 348 | ) { |
| 349 | const focusEmulationEnabled = context.workspaceState.get(focusEmulationStorageKey, false); |
| 350 | const provider = new BrowserOptionsDataProvider(debugSessionTracker, focusEmulationEnabled); |
| 351 | provider._onFocusEmulationChanged = enabled => |
| 352 | context.workspaceState.update(focusEmulationStorageKey, enabled); |
| 353 | |
| 354 | const view = vscode.window.createTreeView(CustomViews.EventListenerBreakpoints, { |
| 355 | treeDataProvider: provider, |
| 356 | showCollapseAll: true, |
| 357 | manageCheckboxStateManually: true, |
| 358 | }); |
| 359 | |
| 360 | context.subscriptions.push( |
| 361 | view.onDidChangeCheckboxState(async e => { |
| 362 | const breakpointChanges: [BreakpointItem, boolean][] = []; |
| 363 | for (const [item, state] of e.items) { |
| 364 | const enabled = state === vscode.TreeItemCheckboxState.Checked; |
| 365 | if (item instanceof FocusEmulationOption) { |
| 366 | provider.setFocusEmulation(enabled); |
| 367 | } else { |
| 368 | breakpointChanges.push([item as BreakpointItem, enabled]); |
| 369 | } |
| 370 | } |
| 371 | if (breakpointChanges.length) { |
| 372 | provider.setBreakpointsEnabled(breakpointChanges); |
| 373 | } |
| 374 | }), |
| 375 | ); |
| 376 | |
| 377 | context.subscriptions.push(view); |
| 378 | |
| 379 | context.subscriptions.push( |
| 380 | vscode.commands.registerCommand(Commands.ToggleCustomBreakpoints, async () => { |
| 381 | const items: (vscode.QuickPickItem & { id: string })[] = [...provider.allCategories].flatMap( |
| 382 | category => [ |
| 383 | { |
| 384 | kind: vscode.QuickPickItemKind.Separator, |
| 385 | id: '', |
| 386 | label: category.label, |
| 387 | }, |
| 388 | ...category.children.map(bp => ({ |
| 389 | id: bp.id, |
| 390 | label: `${bp.label}`, |
| 391 | picked: bp.checked, |
| 392 | })), |
| 393 | ], |
| 394 | ); |
| 395 | |
| 396 | const picked = await vscode.window.showQuickPick(items, { |
| 397 | canPickMany: true, |
| 398 | placeHolder: 'Select breakpoints to enable', |
| 399 | }); |
| 400 | |
| 401 | if (!picked) { |
| 402 | return; |
no test coverage detected