VSCode merge (#4610)

* Merge from vscode e388c734f30757875976c7e326d6cfeee77710de

* fix yarn lcoks

* remove small issue
This commit is contained in:
Anthony Dresser
2019-03-20 10:39:09 -07:00
committed by GitHub
parent 87765e8673
commit c814b92557
310 changed files with 6606 additions and 2129 deletions

View File

@@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
@@ -262,7 +262,7 @@ configurationRegistry.registerConfiguration({
'terminal.integrated.windowsEnableConpty': {
description: nls.localize('terminal.integrated.windowsEnableConpty', "Whether to use ConPTY for Windows terminal process communication (requires Windows 10 build number 18309+). Winpty will be used if this is false."),
type: 'boolean',
default: false
default: true
}
}
});

View File

@@ -27,6 +27,11 @@ import { IRemoteEnvironmentService } from 'vs/workbench/services/remote/common/r
/** The amount of time to consider terminal errors to be related to the launch */
const LAUNCHING_DURATION = 500;
/**
* The minimum amount of time between latency requests.
*/
const LATENCY_MEASURING_INTERVAL = 1000;
/**
* Holds all state related to the creation and management of terminal processes.
*
@@ -46,6 +51,9 @@ export class TerminalProcessManager implements ITerminalProcessManager {
private _process: ITerminalChildProcess | null = null;
private _preLaunchInputQueue: string[] = [];
private _disposables: IDisposable[] = [];
private _latency: number = -1;
private _latencyRequest: Promise<number>;
private _latencyLastMeasured: number = 0;
private readonly _onProcessReady = new Emitter<void>();
public get onProcessReady(): Event<void> { return this._onProcessReady.event; }
@@ -77,6 +85,7 @@ export class TerminalProcessManager implements ITerminalProcessManager {
c(undefined);
});
});
this.ptyProcessReady.then(async () => await this.getLatency());
}
public dispose(immediate: boolean = false): void {
@@ -240,6 +249,18 @@ export class TerminalProcessManager implements ITerminalProcessManager {
return this._process.getCwd();
}
public async getLatency(): Promise<number> {
if (!this._process) {
return Promise.resolve(0);
}
if (this._latencyLastMeasured === 0 || this._latencyLastMeasured + LATENCY_MEASURING_INTERVAL < Date.now()) {
this._latencyRequest = this._process.getLatency();
this._latency = await this._latencyRequest;
this._latencyLastMeasured = Date.now();
}
return Promise.resolve(this._latency);
}
private _onExit(exitCode: number): void {
this._process = null;