Avoid import from workbench/contrib/debug to api

See #141921
This commit is contained in:
Rob Lourens
2022-02-01 18:41:07 -08:00
parent 14290dc9d4
commit 6820250dd8
2 changed files with 22 additions and 25 deletions

View File

@@ -23,8 +23,10 @@ import { SignService } from 'vs/platform/sign/node/signService';
import { IDisposable } from 'vs/base/common/lifecycle';
import { AbstractVariableResolverService } from 'vs/workbench/services/configurationResolver/common/variableResolver';
import { createCancelablePromise, firstParallel } from 'vs/base/common/async';
import { hasChildProcesses, prepareCommand, runInExternalTerminal } from 'vs/workbench/contrib/debug/node/terminals';
import { hasChildProcesses, prepareCommand } from 'vs/workbench/contrib/debug/node/terminals';
import { IExtHostEditorTabs } from 'vs/workbench/api/common/extHostEditorTabs';
import { IExternalTerminalService } from 'vs/platform/externalTerminal/common/externalTerminal';
import { WindowsExternalTerminalService, MacExternalTerminalService, LinuxExternalTerminalService } from 'vs/platform/externalTerminal/node/externalTerminalService';
export class ExtHostDebugService extends ExtHostDebugServiceBase {
@@ -157,6 +159,24 @@ export class ExtHostDebugService extends ExtHostDebugServiceBase {
}
}
let externalTerminalService: IExternalTerminalService | undefined = undefined;
export function runInExternalTerminal(args: DebugProtocol.RunInTerminalRequestArguments, configProvider: ExtHostConfigProvider): Promise<number | undefined> {
if (!externalTerminalService) {
if (platform.isWindows) {
externalTerminalService = new WindowsExternalTerminalService();
} else if (platform.isMacintosh) {
externalTerminalService = new MacExternalTerminalService();
} else if (platform.isLinux) {
externalTerminalService = new LinuxExternalTerminalService();
} else {
throw new Error('external terminals not supported on this platform');
}
}
const config = configProvider.getConfiguration('terminal');
return externalTerminalService.runInTerminal(args.title!, args.cwd, args.args, args.env || {}, config.external || {});
}
class DebugTerminalCollection {
/**
* Delay before a new terminal is a candidate for reuse. See #71850