| 32 | |
| 33 | @injectable() |
| 34 | export class EdgeDevToolOpener implements IExtensionContribution { |
| 35 | constructor(@inject(DebugSessionTracker) private readonly tracker: DebugSessionTracker) {} |
| 36 | |
| 37 | /** @inheritdoc */ |
| 38 | public register(context: vscode.ExtensionContext) { |
| 39 | context.subscriptions.push( |
| 40 | registerCommand(vscode.commands, Commands.OpenEdgeDevTools, async () => { |
| 41 | const session = |
| 42 | vscode.debug.activeDebugSession && qualifies(vscode.debug.activeDebugSession) |
| 43 | ? vscode.debug.activeDebugSession |
| 44 | : await DebugSessionTracker.pickSession( |
| 45 | this.tracker.getConcreteSessions().filter(qualifies), |
| 46 | l10n.t('Select the page where you want to open the devtools'), |
| 47 | ); |
| 48 | |
| 49 | if (!session) { |
| 50 | return; |
| 51 | } |
| 52 | |
| 53 | const rootSession = findRootSession(session); |
| 54 | |
| 55 | try { |
| 56 | return await vscode.commands.executeCommand( |
| 57 | commandId, |
| 58 | session.id, |
| 59 | rootSession.configuration, |
| 60 | ); |
| 61 | } catch (e) { |
| 62 | if (e instanceof Error && /command .+ not found/.test(e.message)) { |
| 63 | return vscode.commands.executeCommand( |
| 64 | 'workbench.extensions.action.showExtensionsWithIds', |
| 65 | [toolExtensionId], |
| 66 | ); |
| 67 | } else { |
| 68 | throw e; |
| 69 | } |
| 70 | } |
| 71 | }), |
| 72 | ); |
| 73 | } |
| 74 | } |
nothing calls this directly
no outgoing calls
no test coverage detected