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

Method register

src/ui/diagnosticsUI.ts:25–86  ·  view source on GitHub ↗
(context: vscode.ExtensionContext)

Source from the content-addressed store, hash-verified

23 ) {}
24
25 public register(context: vscode.ExtensionContext) {
26 context.subscriptions.push(
27 registerCommand(vscode.commands, Commands.GetDiagnosticLogs, async () => {
28 const session = await this.getTargetSession();
29 if (!session) {
30 return;
31 }
32
33 const uri = await vscode.window.showSaveDialog({ filters: { JSON: ['json'] } });
34 if (uri) {
35 session.customRequest('saveDiagnosticLogs', {
36 toFile: uri.fsPath,
37 });
38 }
39 }),
40 registerCommand(
41 vscode.commands,
42 Commands.CreateDiagnostics,
43 async () => this.getDiagnosticInfo(await this.getTargetSession()),
44 ),
45 vscode.debug.onDidReceiveDebugSessionCustomEvent(async evt => {
46 if (evt.event === 'openDiagnosticTool') {
47 return this.openDiagnosticTool(evt.body.file);
48 }
49
50 if (
51 evt.event !== 'suggestDiagnosticTool'
52 || this.dismissedForSession
53 || this.context.workspaceState.get(neverRemindKey)
54 || this.isPrompting
55 ) {
56 return;
57 }
58
59 this.isPrompting = true;
60
61 const yes = l10n.t('Yes');
62 const notNow = l10n.t('Not Now');
63 const never = l10n.t('Never');
64 const response = await vscode.window.showInformationMessage(
65 'It looks like you might be having trouble with breakpoints. Would you like to open our diagnostic tool?',
66 yes,
67 notNow,
68 never,
69 );
70
71 this.isPrompting = false;
72
73 switch (response) {
74 case yes:
75 this.getDiagnosticInfo(await this.getTargetSession(), true);
76 break;
77 case never:
78 context.workspaceState.update(neverRemindKey, true);
79 break;
80 case notNow:
81 this.dismissedForSession = true;
82 break;

Callers

nothing calls this directly

Calls 8

getTargetSessionMethod · 0.95
getDiagnosticInfoMethod · 0.95
openDiagnosticToolMethod · 0.95
registerCommandFunction · 0.90
customRequestMethod · 0.80
pushMethod · 0.65
getMethod · 0.65
updateMethod · 0.65

Tested by

no test coverage detected