mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-26 01:25:38 -05:00
Merge from vscode 2cfc8172e533e50c90e6a3152f6bfb1f82f963f3 (#6516)
* Merge from vscode 2cfc8172e533e50c90e6a3152f6bfb1f82f963f3 * fix tests
This commit is contained in:
@@ -66,7 +66,6 @@ import * as vscode from 'vscode';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { originalFSPath } from 'vs/base/common/resources';
|
||||
import { CLIServer } from 'vs/workbench/api/node/extHostCLIServer';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
import { values } from 'vs/base/common/collections';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { IURITransformer } from 'vs/base/common/uriIpc';
|
||||
@@ -75,6 +74,7 @@ import { ExtHostLabelService } from 'vs/workbench/api/common/extHostLabelService
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
import { getSingletonServiceDescriptors } from 'vs/platform/instantiation/common/extensions';
|
||||
import { getRemoteName } from 'vs/platform/remote/common/remoteHosts';
|
||||
|
||||
export interface IExtensionApiFactory {
|
||||
(extension: IExtensionDescription, registry: ExtensionDescriptionRegistry, configProvider: ExtHostConfigProvider): typeof vscode;
|
||||
@@ -249,7 +249,11 @@ export function createApiFactory(
|
||||
},
|
||||
getCommands(filterInternal: boolean = false): Thenable<string[]> {
|
||||
return extHostCommands.getCommands(filterInternal);
|
||||
}
|
||||
},
|
||||
onDidExecuteCommand: proposedApiFunction(extension, (listener, thisArgs?, disposables?) => {
|
||||
checkProposedApiEnabled(extension);
|
||||
return extHostCommands.onDidExecuteCommand(listener, thisArgs, disposables);
|
||||
}),
|
||||
};
|
||||
|
||||
// namespace: env
|
||||
@@ -278,15 +282,7 @@ export function createApiFactory(
|
||||
return extHostWindow.openUri(uri, { allowTunneling: !!initData.remote.isRemote });
|
||||
},
|
||||
get remoteName() {
|
||||
if (!initData.remote.authority) {
|
||||
return undefined;
|
||||
}
|
||||
const pos = initData.remote.authority.indexOf('+');
|
||||
if (pos < 0) {
|
||||
// funky? bad authority?
|
||||
return initData.remote.authority;
|
||||
}
|
||||
return initData.remote.authority.substr(0, pos);
|
||||
return getRemoteName(initData.remote.authority);
|
||||
}
|
||||
};
|
||||
if (!initData.environment.extensionTestsLocationURI) {
|
||||
@@ -540,10 +536,10 @@ export function createApiFactory(
|
||||
checkProposedApiEnabled(extension);
|
||||
return extHostEditorInsets.createWebviewEditorInset(editor, line, height, options, extension);
|
||||
},
|
||||
createTerminal(nameOrOptions?: vscode.TerminalOptions | vscode.TerminalVirtualProcessOptions | string, shellPath?: string, shellArgs?: string[] | string): vscode.Terminal {
|
||||
createTerminal(nameOrOptions?: vscode.TerminalOptions | vscode.ExtensionTerminalOptions | string, shellPath?: string, shellArgs?: string[] | string): vscode.Terminal {
|
||||
if (typeof nameOrOptions === 'object') {
|
||||
if ('virtualProcess' in nameOrOptions) {
|
||||
return extHostTerminalService.createVirtualProcessTerminal(nameOrOptions);
|
||||
if ('pty' in nameOrOptions) {
|
||||
return extHostTerminalService.createExtensionTerminal(nameOrOptions);
|
||||
} else {
|
||||
nameOrOptions.hideFromUser = nameOrOptions.hideFromUser || (nameOrOptions.runInBackground && extension.enableProposedApi);
|
||||
return extHostTerminalService.createTerminalFromOptions(nameOrOptions);
|
||||
@@ -613,7 +609,8 @@ export function createApiFactory(
|
||||
return extHostWorkspace.getRelativePath(pathOrUri, includeWorkspace);
|
||||
},
|
||||
findFiles: (include, exclude, maxResults?, token?) => {
|
||||
return extHostWorkspace.findFiles(typeConverters.GlobPattern.from(include), typeConverters.GlobPattern.from(withNullAsUndefined(exclude)), maxResults, extension.identifier, token);
|
||||
// Note, undefined/null have different meanings on "exclude"
|
||||
return extHostWorkspace.findFiles(typeConverters.GlobPattern.from(include), typeConverters.GlobPattern.from(exclude), maxResults, extension.identifier, token);
|
||||
},
|
||||
findTextInFiles: (query: vscode.TextSearchQuery, optionsOrCallback: vscode.FindTextInFilesOptions | ((result: vscode.TextSearchResult) => void), callbackOrToken?: vscode.CancellationToken | ((result: vscode.TextSearchResult) => void), token?: vscode.CancellationToken) => {
|
||||
let options: vscode.FindTextInFilesOptions;
|
||||
|
||||
@@ -20,7 +20,7 @@ import { AbstractDebugAdapter } from 'vs/workbench/contrib/debug/common/abstract
|
||||
import { IExtHostWorkspaceProvider } from 'vs/workbench/api/common/extHostWorkspace';
|
||||
import { ExtHostExtensionService } from 'vs/workbench/api/node/extHostExtensionService';
|
||||
import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors';
|
||||
import { ITerminalSettings, IDebuggerContribution, IConfig, IDebugAdapter, IDebugAdapterServer, IDebugAdapterExecutable, IAdapterDescriptor } from 'vs/workbench/contrib/debug/common/debug';
|
||||
import { IDebuggerContribution, IConfig, IDebugAdapter, IDebugAdapterServer, IDebugAdapterExecutable, IAdapterDescriptor } from 'vs/workbench/contrib/debug/common/debug';
|
||||
import { hasChildProcesses, prepareCommand, runInExternalTerminal } from 'vs/workbench/contrib/debug/node/terminals';
|
||||
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import { AbstractVariableResolverService } from 'vs/workbench/services/configurationResolver/common/variableResolver';
|
||||
@@ -34,6 +34,8 @@ import { ExtHostCommands } from 'vs/workbench/api/common/extHostCommands';
|
||||
import { ExtensionDescriptionRegistry } from 'vs/workbench/services/extensions/common/extensionDescriptionRegistry';
|
||||
import { IProcessEnvironment } from 'vs/base/common/platform';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { SignService } from 'vs/platform/sign/node/signService';
|
||||
import { ISignService } from 'vs/platform/sign/common/sign';
|
||||
|
||||
export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
|
||||
@@ -81,6 +83,8 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
private _integratedTerminalInstance?: vscode.Terminal;
|
||||
private _terminalDisposedListener: IDisposable;
|
||||
|
||||
private _signService: ISignService;
|
||||
|
||||
|
||||
constructor(mainContext: IMainContext,
|
||||
private _workspaceService: IExtHostWorkspaceProvider,
|
||||
@@ -314,7 +318,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
|
||||
// RPC methods (ExtHostDebugServiceShape)
|
||||
|
||||
public $runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): Promise<number | undefined> {
|
||||
public async $runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments): Promise<number | undefined> {
|
||||
|
||||
if (args.kind === 'integrated') {
|
||||
|
||||
@@ -337,10 +341,22 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
} else {
|
||||
resolve(true);
|
||||
}
|
||||
}).then(needNewTerminal => {
|
||||
}).then(async needNewTerminal => {
|
||||
|
||||
const configProvider = await this._configurationService.getConfigProvider();
|
||||
const shell = this._terminalService.getDefaultShell(configProvider);
|
||||
|
||||
if (needNewTerminal || !this._integratedTerminalInstance) {
|
||||
this._integratedTerminalInstance = this._terminalService.createTerminal(args.title || nls.localize('debug.terminal.title', "debuggee"));
|
||||
const options: vscode.TerminalOptions = {
|
||||
shellPath: shell,
|
||||
// shellArgs: this._terminalService._getDefaultShellArgs(configProvider),
|
||||
cwd: args.cwd,
|
||||
name: args.title || nls.localize('debug.terminal.title', "debuggee"),
|
||||
env: args.env
|
||||
};
|
||||
delete args.cwd;
|
||||
delete args.env;
|
||||
this._integratedTerminalInstance = this._terminalService.createTerminalFromOptions(options);
|
||||
}
|
||||
const terminal: vscode.Terminal = this._integratedTerminalInstance;
|
||||
|
||||
@@ -348,7 +364,8 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
|
||||
return this._integratedTerminalInstance.processId.then(shellProcessId => {
|
||||
|
||||
const command = prepareCommand(args, config);
|
||||
const command = prepareCommand(args, shell, configProvider);
|
||||
|
||||
terminal.sendText(command, true);
|
||||
|
||||
return shellProcessId;
|
||||
@@ -357,7 +374,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
|
||||
} else if (args.kind === 'external') {
|
||||
|
||||
runInExternalTerminal(args, config);
|
||||
runInExternalTerminal(args, await this._configurationService.getConfigProvider());
|
||||
}
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
@@ -421,16 +438,45 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
this._debugAdaptersTrackers.set(debugAdapterHandle, tracker);
|
||||
}
|
||||
|
||||
debugAdapter.onMessage(message => {
|
||||
debugAdapter.onMessage(async message => {
|
||||
|
||||
if (tracker && tracker.onDidSendMessage) {
|
||||
tracker.onDidSendMessage(message);
|
||||
if (message.type === 'request' && (<DebugProtocol.Request>message).command === 'handshake') {
|
||||
|
||||
const request = <DebugProtocol.Request>message;
|
||||
|
||||
const response: DebugProtocol.Response = {
|
||||
type: 'response',
|
||||
seq: 0,
|
||||
command: request.command,
|
||||
request_seq: request.seq,
|
||||
success: true
|
||||
};
|
||||
|
||||
if (!this._signService) {
|
||||
this._signService = new SignService();
|
||||
}
|
||||
|
||||
try {
|
||||
const signature = await this._signService.sign(request.arguments.value);
|
||||
response.body = {
|
||||
signature: signature
|
||||
};
|
||||
debugAdapter.sendResponse(response);
|
||||
} catch (e) {
|
||||
response.success = false;
|
||||
response.message = e.message;
|
||||
debugAdapter.sendResponse(response);
|
||||
}
|
||||
} else {
|
||||
if (tracker && tracker.onDidSendMessage) {
|
||||
tracker.onDidSendMessage(message);
|
||||
}
|
||||
|
||||
// DA -> VS Code
|
||||
message = convertToVSCPaths(message, true);
|
||||
|
||||
mythis._debugServiceProxy.$acceptDAMessage(debugAdapterHandle, message);
|
||||
}
|
||||
|
||||
// DA -> VS Code
|
||||
message = convertToVSCPaths(message, true);
|
||||
|
||||
mythis._debugServiceProxy.$acceptDAMessage(debugAdapterHandle, message);
|
||||
});
|
||||
debugAdapter.onError(err => {
|
||||
if (tracker && tracker.onError) {
|
||||
|
||||
@@ -322,15 +322,6 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
|
||||
|
||||
private _logExtensionActivationTimes(extensionDescription: IExtensionDescription, reason: ExtensionActivationReason, outcome: string, activationTimes?: ExtensionActivationTimes) {
|
||||
const event = getTelemetryActivationEvent(extensionDescription, reason);
|
||||
/* __GDPR__
|
||||
"extensionActivationTimes" : {
|
||||
"${include}": [
|
||||
"${TelemetryActivationEvent}",
|
||||
"${ExtensionActivationTimes}"
|
||||
],
|
||||
"outcome" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
type ExtensionActivationTimesClassification = {
|
||||
outcome: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
|
||||
} & TelemetryActivationEventFragment & ExtensionActivationTimesFragment;
|
||||
|
||||
@@ -589,9 +589,7 @@ export class ExtHostTask implements ExtHostTaskShape {
|
||||
|
||||
// Clone the custom execution to keep the original untouched. This is important for multiple runs of the same task.
|
||||
this._activeCustomExecutions2.set(execution.id, execution2);
|
||||
this._terminalService.performTerminalIdAction(terminalId, async terminal => {
|
||||
this._terminalService.attachVirtualProcessToTerminal(terminalId, await execution2.callback());
|
||||
});
|
||||
await this._terminalService.attachPtyToTerminal(terminalId, await execution2.callback());
|
||||
}
|
||||
|
||||
// Once a terminal is spun up for the custom execution task this event will be fired.
|
||||
|
||||
@@ -91,7 +91,7 @@ export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Termi
|
||||
this._idPromise.then(c => {
|
||||
this._proxy.$registerOnDataListener(this._id);
|
||||
});
|
||||
return this._onData && this._onData.event;
|
||||
return this._onData.event;
|
||||
}
|
||||
|
||||
constructor(
|
||||
@@ -110,7 +110,7 @@ export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Termi
|
||||
});
|
||||
}
|
||||
|
||||
public create(
|
||||
public async create(
|
||||
shellPath?: string,
|
||||
shellArgs?: string[] | string,
|
||||
cwd?: string | URI,
|
||||
@@ -118,18 +118,16 @@ export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Termi
|
||||
waitOnExit?: boolean,
|
||||
strictEnv?: boolean,
|
||||
hideFromUser?: boolean
|
||||
): void {
|
||||
this._proxy.$createTerminal({ name: this._name, shellPath, shellArgs, cwd, env, waitOnExit, strictEnv, hideFromUser }).then(terminal => {
|
||||
this._name = terminal.name;
|
||||
this._runQueuedRequests(terminal.id);
|
||||
});
|
||||
): Promise<void> {
|
||||
const terminal = await this._proxy.$createTerminal({ name: this._name, shellPath, shellArgs, cwd, env, waitOnExit, strictEnv, hideFromUser });
|
||||
this._name = terminal.name;
|
||||
this._runQueuedRequests(terminal.id);
|
||||
}
|
||||
|
||||
public createVirtualProcess(): Promise<void> {
|
||||
return this._proxy.$createTerminal({ name: this._name, isVirtualProcess: true }).then(terminal => {
|
||||
this._name = terminal.name;
|
||||
this._runQueuedRequests(terminal.id);
|
||||
});
|
||||
public async createExtensionTerminal(): Promise<void> {
|
||||
const terminal = await this._proxy.$createTerminal({ name: this._name, isExtensionTerminal: true });
|
||||
this._name = terminal.name;
|
||||
this._runQueuedRequests(terminal.id);
|
||||
}
|
||||
|
||||
public get name(): string {
|
||||
@@ -312,9 +310,9 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
|
||||
private _logService: ILogService
|
||||
) {
|
||||
this._proxy = mainContext.getProxy(MainContext.MainThreadTerminalService);
|
||||
this.updateLastActiveWorkspace();
|
||||
this.updateVariableResolver();
|
||||
this.registerListeners();
|
||||
this._updateLastActiveWorkspace();
|
||||
this._updateVariableResolver();
|
||||
this._registerListeners();
|
||||
}
|
||||
|
||||
public createTerminal(name?: string, shellPath?: string, shellArgs?: string[] | string): vscode.Terminal {
|
||||
@@ -331,20 +329,20 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
|
||||
return terminal;
|
||||
}
|
||||
|
||||
public createVirtualProcessTerminal(options: vscode.TerminalVirtualProcessOptions): vscode.Terminal {
|
||||
public createExtensionTerminal(options: vscode.ExtensionTerminalOptions): vscode.Terminal {
|
||||
const terminal = new ExtHostTerminal(this._proxy, options.name);
|
||||
const p = new ExtHostVirtualProcess(options.virtualProcess);
|
||||
terminal.createVirtualProcess().then(() => this._setupExtHostProcessListeners(terminal._id, p));
|
||||
const p = new ExtHostPseudoterminal(options.pty);
|
||||
terminal.createExtensionTerminal().then(() => this._setupExtHostProcessListeners(terminal._id, p));
|
||||
this._terminals.push(terminal);
|
||||
return terminal;
|
||||
}
|
||||
|
||||
public attachVirtualProcessToTerminal(id: number, virtualProcess: vscode.TerminalVirtualProcess) {
|
||||
const terminal = this._getTerminalById(id);
|
||||
public async attachPtyToTerminal(id: number, pty: vscode.Pseudoterminal): Promise<void> {
|
||||
const terminal = this._getTerminalByIdEventually(id);
|
||||
if (!terminal) {
|
||||
throw new Error(`Cannot resolve terminal with id ${id} for virtual process`);
|
||||
}
|
||||
const p = new ExtHostVirtualProcess(virtualProcess);
|
||||
const p = new ExtHostPseudoterminal(pty);
|
||||
this._setupExtHostProcessListeners(id, p);
|
||||
}
|
||||
|
||||
@@ -534,25 +532,25 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
|
||||
return env;
|
||||
}
|
||||
|
||||
private registerListeners(): void {
|
||||
this._extHostDocumentsAndEditors.onDidChangeActiveTextEditor(() => this.updateLastActiveWorkspace());
|
||||
this._extHostWorkspace.onDidChangeWorkspace(() => this.updateVariableResolver());
|
||||
private _registerListeners(): void {
|
||||
this._extHostDocumentsAndEditors.onDidChangeActiveTextEditor(() => this._updateLastActiveWorkspace());
|
||||
this._extHostWorkspace.onDidChangeWorkspace(() => this._updateVariableResolver());
|
||||
}
|
||||
|
||||
private updateLastActiveWorkspace(): void {
|
||||
private _updateLastActiveWorkspace(): void {
|
||||
const activeEditor = this._extHostDocumentsAndEditors.activeEditor();
|
||||
if (activeEditor) {
|
||||
this._lastActiveWorkspace = this._extHostWorkspace.getWorkspaceFolder(activeEditor.document.uri) as IWorkspaceFolder;
|
||||
}
|
||||
}
|
||||
|
||||
private async updateVariableResolver(): Promise<void> {
|
||||
private async _updateVariableResolver(): Promise<void> {
|
||||
const configProvider = await this._extHostConfiguration.getConfigProvider();
|
||||
const workspaceFolders = await this._extHostWorkspace.getWorkspaceFolders2();
|
||||
this._variableResolver = new ExtHostVariableResolverService(workspaceFolders || [], this._extHostDocumentsAndEditors, configProvider);
|
||||
}
|
||||
|
||||
public async $createProcess(id: number, shellLaunchConfigDto: ShellLaunchConfigDto, activeWorkspaceRootUriComponents: UriComponents, cols: number, rows: number, isWorkspaceShellAllowed: boolean): Promise<void> {
|
||||
public async $spawnExtHostProcess(id: number, shellLaunchConfigDto: ShellLaunchConfigDto, activeWorkspaceRootUriComponents: UriComponents, cols: number, rows: number, isWorkspaceShellAllowed: boolean): Promise<void> {
|
||||
const shellLaunchConfig: IShellLaunchConfig = {
|
||||
name: shellLaunchConfigDto.name,
|
||||
executable: shellLaunchConfigDto.executable,
|
||||
@@ -612,6 +610,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
|
||||
baseEnv
|
||||
);
|
||||
|
||||
this._proxy.$sendResolvedLaunchConfig(id, shellLaunchConfig);
|
||||
// Fork the process and listen for messages
|
||||
this._logService.debug(`Terminal process launching on ext host`, shellLaunchConfig, initialCwd, cols, rows, env);
|
||||
// TODO: Support conpty on remote, it doesn't seem to work for some reason?
|
||||
@@ -620,8 +619,22 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
|
||||
this._setupExtHostProcessListeners(id, new TerminalProcess(shellLaunchConfig, initialCwd, cols, rows, env, enableConpty, this._logService));
|
||||
}
|
||||
|
||||
public $startVirtualProcess(id: number, initialDimensions: ITerminalDimensionsDto | undefined): void {
|
||||
(this._terminalProcesses[id] as ExtHostVirtualProcess).startSendingEvents(initialDimensions);
|
||||
public async $startExtensionTerminal(id: number, initialDimensions: ITerminalDimensionsDto | undefined): Promise<void> {
|
||||
// Make sure the ExtHostTerminal exists so onDidOpenTerminal has fired before we call
|
||||
// Pseudoterminal.start
|
||||
await this._getTerminalByIdEventually(id);
|
||||
|
||||
// Processes should be initialized here for normal virtual process terminals, however for
|
||||
// tasks they are responsible for attaching the virtual process to a terminal so this
|
||||
// function may be called before tasks is able to attach to the terminal.
|
||||
let retries = 5;
|
||||
while (retries-- > 0) {
|
||||
if (this._terminalProcesses[id]) {
|
||||
(this._terminalProcesses[id] as ExtHostPseudoterminal).startSendingEvents(initialDimensions);
|
||||
return;
|
||||
}
|
||||
await timeout(50);
|
||||
}
|
||||
}
|
||||
|
||||
private _setupExtHostProcessListeners(id: number, p: ITerminalChildProcess): void {
|
||||
@@ -760,7 +773,7 @@ class ApiRequest {
|
||||
}
|
||||
}
|
||||
|
||||
class ExtHostVirtualProcess implements ITerminalChildProcess {
|
||||
class ExtHostPseudoterminal implements ITerminalChildProcess {
|
||||
private _queuedEvents: (IQueuedEvent<string> | IQueuedEvent<number> | IQueuedEvent<{ pid: number, cwd: string }> | IQueuedEvent<ITerminalDimensions | undefined>)[] = [];
|
||||
private _queueDisposables: IDisposable[] | undefined;
|
||||
|
||||
@@ -776,33 +789,33 @@ class ExtHostVirtualProcess implements ITerminalChildProcess {
|
||||
public get onProcessOverrideDimensions(): Event<ITerminalDimensions | undefined> { return this._onProcessOverrideDimensions.event; }
|
||||
|
||||
constructor(
|
||||
private readonly _virtualProcess: vscode.TerminalVirtualProcess
|
||||
private readonly _pty: vscode.Pseudoterminal
|
||||
) {
|
||||
this._queueDisposables = [];
|
||||
this._queueDisposables.push(this._virtualProcess.onDidWrite(e => this._queuedEvents.push({ emitter: this._onProcessData, data: e })));
|
||||
if (this._virtualProcess.onDidExit) {
|
||||
this._queueDisposables.push(this._virtualProcess.onDidExit(e => this._queuedEvents.push({ emitter: this._onProcessExit, data: e })));
|
||||
this._queueDisposables.push(this._pty.onDidWrite(e => this._queuedEvents.push({ emitter: this._onProcessData, data: e })));
|
||||
if (this._pty.onDidClose) {
|
||||
this._queueDisposables.push(this._pty.onDidClose(e => this._queuedEvents.push({ emitter: this._onProcessExit, data: 0 })));
|
||||
}
|
||||
if (this._virtualProcess.onDidOverrideDimensions) {
|
||||
this._queueDisposables.push(this._virtualProcess.onDidOverrideDimensions(e => this._queuedEvents.push({ emitter: this._onProcessOverrideDimensions, data: e ? { cols: e.columns, rows: e.rows } : undefined })));
|
||||
if (this._pty.onDidOverrideDimensions) {
|
||||
this._queueDisposables.push(this._pty.onDidOverrideDimensions(e => this._queuedEvents.push({ emitter: this._onProcessOverrideDimensions, data: e ? { cols: e.columns, rows: e.rows } : undefined })));
|
||||
}
|
||||
}
|
||||
|
||||
shutdown(): void {
|
||||
if (this._virtualProcess.shutdown) {
|
||||
this._virtualProcess.shutdown();
|
||||
if (this._pty.close) {
|
||||
this._pty.close();
|
||||
}
|
||||
}
|
||||
|
||||
input(data: string): void {
|
||||
if (this._virtualProcess.handleInput) {
|
||||
this._virtualProcess.handleInput(data);
|
||||
if (this._pty.handleInput) {
|
||||
this._pty.handleInput(data);
|
||||
}
|
||||
}
|
||||
|
||||
resize(cols: number, rows: number): void {
|
||||
if (this._virtualProcess.setDimensions) {
|
||||
this._virtualProcess.setDimensions({ columns: cols, rows });
|
||||
if (this._pty.setDimensions) {
|
||||
this._pty.setDimensions({ columns: cols, rows });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -825,19 +838,16 @@ class ExtHostVirtualProcess implements ITerminalChildProcess {
|
||||
this._queueDisposables = undefined;
|
||||
|
||||
// Attach the real listeners
|
||||
this._virtualProcess.onDidWrite(e => this._onProcessData.fire(e));
|
||||
if (this._virtualProcess.onDidExit) {
|
||||
this._virtualProcess.onDidExit(e => {
|
||||
// Ensure only positive exit codes are returned
|
||||
this._onProcessExit.fire(e >= 0 ? e : 1);
|
||||
});
|
||||
this._pty.onDidWrite(e => this._onProcessData.fire(e));
|
||||
if (this._pty.onDidClose) {
|
||||
this._pty.onDidClose(e => this._onProcessExit.fire(0));
|
||||
}
|
||||
if (this._virtualProcess.onDidOverrideDimensions) {
|
||||
this._virtualProcess.onDidOverrideDimensions(e => this._onProcessOverrideDimensions.fire(e ? { cols: e.columns, rows: e.rows } : undefined)); // {{SQL CARBON EDIT}} strict-null-check
|
||||
if (this._pty.onDidOverrideDimensions) {
|
||||
this._pty.onDidOverrideDimensions(e => this._onProcessOverrideDimensions.fire(e ? { cols: e.columns, rows: e.rows } : undefined)); // {{SQL CARBON EDIT}} strict-null-checks
|
||||
}
|
||||
|
||||
if (this._virtualProcess.start) {
|
||||
this._virtualProcess.start(initialDimensions);
|
||||
if (this._pty.open) {
|
||||
this._pty.open(initialDimensions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user