(workspaceFolder: vscode.WorkspaceFolder | undefined)
| 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 () => { |
no test coverage detected