MCPcopy
hub / github.com/microsoft/vscode-js-debug / registerCustomBreakpointsUI

Function registerCustomBreakpointsUI

src/ui/customBreakpointsUI.ts:345–458  ·  view source on GitHub ↗
(
  context: vscode.ExtensionContext,
  debugSessionTracker: DebugSessionTracker,
)

Source from the content-addressed store, hash-verified

343}
344
345export 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;

Callers 1

activateFunction · 0.90

Calls 11

setFocusEmulationMethod · 0.95
setBreakpointsEnabledMethod · 0.95
addXHRBreakpointsMethod · 0.95
removeXHRBreakpointMethod · 0.95
mapMethod · 0.80
getMethod · 0.65
updateMethod · 0.65
pushMethod · 0.65
hasMethod · 0.65
disposeMethod · 0.65
showMethod · 0.65

Tested by

no test coverage detected