( context: vscode.ExtensionContext, delegateFactory: DelegateLauncherFactory, linkHandler: TerminalLinkHandler, )
| 128 | * Registers a command to launch the debugger terminal. |
| 129 | */ |
| 130 | export function registerDebugTerminalUI( |
| 131 | context: vscode.ExtensionContext, |
| 132 | delegateFactory: DelegateLauncherFactory, |
| 133 | linkHandler: TerminalLinkHandler, |
| 134 | ) { |
| 135 | /** |
| 136 | * See docblocks on {@link DelegateLauncher} for more information on |
| 137 | * how this works. |
| 138 | */ |
| 139 | function launchTerminal( |
| 140 | delegate: DelegateLauncherFactory, |
| 141 | command?: string, |
| 142 | workspaceFolder?: vscode.WorkspaceFolder, |
| 143 | defaultConfig?: Partial<ITerminalLaunchConfiguration>, |
| 144 | ) { |
| 145 | const launcher = new TerminalNodeLauncher(new NodeBinaryProvider(), new ProxyLogger(), fs); |
| 146 | launcher.onTerminalCreated(terminal => { |
| 147 | linkHandler.enableHandlingInTerminal(terminal); |
| 148 | }); |
| 149 | |
| 150 | launchVirtualTerminalParent(delegate, launcher, { |
| 151 | command, |
| 152 | ...defaultConfig, |
| 153 | __workspaceFolder: workspaceFolder?.uri.fsPath, |
| 154 | }); |
| 155 | |
| 156 | return Promise.resolve(); |
| 157 | } |
| 158 | |
| 159 | context.subscriptions.push( |
| 160 | registerCommand(vscode.commands, Commands.CreateDebuggerTerminal, (command, folder, config) => |
| 161 | launchTerminal( |
| 162 | delegateFactory, |
| 163 | command, |
| 164 | folder ?? vscode.workspace.workspaceFolders?.[0], |
| 165 | config, |
| 166 | ), |
| 167 | ), |
| 168 | vscode.window.registerTerminalLinkHandler?.(linkHandler), |
| 169 | ); |
| 170 | } |
no test coverage detected