MCPcopy Create free account
hub / github.com/Snapchat/Valdi / registerDebugTerminalUI

Function registerDebugTerminalUI

valdi/vscode_debugger/src/ui/debugTerminalUI.ts:130–170  ·  view source on GitHub ↗
(
  context: vscode.ExtensionContext,
  delegateFactory: DelegateLauncherFactory,
  linkHandler: TerminalLinkHandler,
)

Source from the content-addressed store, hash-verified

128 * Registers a command to launch the debugger terminal.
129 */
130export 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}

Callers 1

activateFunction · 0.90

Calls 3

registerCommandFunction · 0.90
launchTerminalFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected