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

Function acquireLauncher

src/ui/autoAttach.ts:29–72  ·  view source on GitHub ↗
(workspaceFolder: vscode.WorkspaceFolder | undefined)

Source from the content-addressed store, hash-verified

27 let disposeTimeout: NodeJS.Timeout | undefined;
28
29 const acquireLauncher = (workspaceFolder: vscode.WorkspaceFolder | undefined) => {
30 const prev = launchers.get(workspaceFolder);
31 if (prev) {
32 return prev;
33 }
34
35 const launcher = (async () => {
36 const logger = new ProxyLogger();
37 let config = readConfig(vscode.workspace, Configuration.TerminalDebugConfig);
38 if (workspaceFolder) {
39 const fsPath = workspaceFolder?.uri.fsPath;
40 config = { ...config, cwd: fsPath, __workspaceFolder: fsPath };
41 }
42 // TODO: Figure out how to inject FsUtils
43 const inst = new AutoAttachLauncher(
44 new NodeBinaryProvider(logger, services.get(FS), noPackageJsonProvider, config || {}),
45 logger,
46 context,
47 services.get(FS),
48 services.get(NodeOnlyPathResolverFactory),
49 services.get(IPortLeaseTracker),
50 );
51
52 await launchVirtualTerminalParent(delegate, inst, config);
53
54 inst.onTargetListChanged(() => {
55 if (inst.targetList().length === 0 && !disposeTimeout) {
56 disposeTimeout = setTimeout(() => {
57 launchers.delete(workspaceFolder);
58 inst.terminate();
59 }, 5 * 60 * 1000);
60 } else if (disposeTimeout) {
61 clearTimeout(disposeTimeout);
62 disposeTimeout = undefined;
63 }
64 });
65
66 return inst;
67 })();
68
69 launchers.set(workspaceFolder, launcher);
70
71 return launcher;
72 };
73
74 context.subscriptions.push(
75 registerCommand(vscode.commands, Commands.AutoAttachSetVariables, async () => {

Callers 1

registerAutoAttachFunction · 0.85

Calls 7

readConfigFunction · 0.90
getMethod · 0.65
targetListMethod · 0.65
deleteMethod · 0.65
terminateMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected