Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973 (#6381)

* Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973

* disable strict null check
This commit is contained in:
Anthony Dresser
2019-07-15 22:35:46 -07:00
committed by GitHub
parent f720ec642f
commit 0b7e7ddbf9
2406 changed files with 59140 additions and 35464 deletions

View File

@@ -3,13 +3,15 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { Event } from 'vs/base/common/event';
import { IDisposable } from 'vs/base/common/lifecycle';
import * as platform from 'vs/base/common/platform';
import { RawContextKey, ContextKeyExpr, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { URI } from 'vs/base/common/uri';
import { FindReplaceState } from 'vs/editor/contrib/find/findState';
import { OperatingSystem } from 'vs/base/common/platform';
import { IOpenFileRequest } from 'vs/platform/windows/common/windows';
export const TERMINAL_PANEL_ID = 'workbench.panel.terminal';
@@ -45,6 +47,7 @@ export const NEVER_MEASURE_RENDER_TIME_STORAGE_KEY = 'terminal.integrated.neverM
export const EXT_HOST_CREATION_DELAY = 100;
export const ITerminalService = createDecorator<ITerminalService>('terminalService');
export const ITerminalNativeService = createDecorator<ITerminalNativeService>('terminalNativeService');
export const TerminalCursorStyle = {
BLOCK: 'block',
@@ -54,10 +57,14 @@ export const TerminalCursorStyle = {
export const TERMINAL_CONFIG_SECTION = 'terminal.integrated';
export const TERMINAL_ACTION_CATEGORY = nls.localize('terminalCategory', "Terminal");
export const DEFAULT_LETTER_SPACING = 0;
export const MINIMUM_LETTER_SPACING = -5;
export const DEFAULT_LINE_HEIGHT = 1;
export const SHELL_PATH_INVALID_EXIT_CODE = -1;
export const SHELL_PATH_DIRECTORY_EXIT_CODE = -2;
export const SHELL_CWD_INVALID_EXIT_CODE = -3;
export type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
@@ -92,6 +99,7 @@ export interface ITerminalConfiguration {
cwd: string;
confirmOnExit: boolean;
enableBell: boolean;
inheritEnv: boolean;
env: {
linux: { [key: string]: string };
osx: { [key: string]: string };
@@ -101,21 +109,19 @@ export interface ITerminalConfiguration {
experimentalBufferImpl: 'JsArray' | 'TypedArray';
splitCwd: 'workspaceRoot' | 'initial' | 'inherited';
windowsEnableConpty: boolean;
enableLatencyMitigation: boolean;
experimentalRefreshOnResume: boolean;
}
export interface ITerminalConfigHelper {
config: ITerminalConfiguration;
onWorkspacePermissionsChanged: Event<boolean>;
configFontIsMonospace(): boolean;
getFont(): ITerminalFont;
/**
* Merges the default shell path and args into the provided launch configuration
*/
mergeDefaultShellPathAndArgs(shell: IShellLaunchConfig, defaultShell: string, platformOverride?: platform.Platform): void;
/** Sets whether a workspace shell configuration is allowed or not */
setWorkspaceShellAllowed(isAllowed: boolean): void;
checkWorkspaceShellPermissions(osOverride?: platform.OperatingSystem): boolean;
checkWorkspaceShellPermissions(osOverride?: OperatingSystem): boolean;
}
export interface ITerminalFont {
@@ -162,7 +168,7 @@ export interface IShellLaunchConfig {
env?: ITerminalEnvironment;
/**
* Whether to ignore a custom cwd from the `terminal.integrated.cwd` settings key (eg. if the
* Whether to ignore a custom cwd from the `terminal.integrated.cwd` settings key (e.g. if the
* shell is being launched by an extension).
*/
ignoreConfigurationCwd?: boolean;
@@ -179,11 +185,15 @@ export interface IShellLaunchConfig {
initialText?: string;
/**
* When true the terminal will be created with no process. This is primarily used to give
* extensions full control over the terminal.
* @deprecated use `isVirtualProcess`
*/
isRendererOnly?: boolean;
/**
* When true an extension is acting as the terminal's process.
*/
isVirtualProcess?: boolean;
/**
* Whether the terminal process environment should be exactly as provided in
* `TerminalOptions.env`. When this is false (default), the environment will be based on the
@@ -192,6 +202,15 @@ export interface IShellLaunchConfig {
* provided as nothing will be inherited from the process or any configuration.
*/
strictEnv?: boolean;
/**
* When enabled the terminal will run the process as normal but not be surfaced to the user
* until `Terminal.show` is called. The typical usage for this is when you need to run
* something that may need interactivity but only want to tell the user about it when
* interaction is needed. Note that the terminals will still be exposed to all extensions
* as normal.
*/
hideFromUser?: boolean;
}
export interface ITerminalService {
@@ -199,18 +218,22 @@ export interface ITerminalService {
activeTabIndex: number;
configHelper: ITerminalConfigHelper;
terminalInstances: ITerminalInstance[];
terminalTabs: ITerminalTab[];
onActiveTabChanged: Event<void>;
onTabDisposed: Event<ITerminalTab>;
onInstanceCreated: Event<ITerminalInstance>;
onInstanceDisposed: Event<ITerminalInstance>;
onInstanceProcessIdReady: Event<ITerminalInstance>;
onInstanceDimensionsChanged: Event<ITerminalInstance>;
onInstanceMaximumDimensionsChanged: Event<ITerminalInstance>;
onInstanceRequestExtHostProcess: Event<ITerminalProcessExtHostRequest>;
onInstanceRequestVirtualProcess: Event<ITerminalVirtualProcessRequest>;
onInstancesChanged: Event<void>;
onInstanceTitleChanged: Event<ITerminalInstance>;
onActiveInstanceChanged: Event<ITerminalInstance | undefined>;
terminalInstances: ITerminalInstance[];
terminalTabs: ITerminalTab[];
onRequestAvailableShells: Event<IAvailableShellsRequest>;
/**
* Creates a terminal.
@@ -228,7 +251,7 @@ export interface ITerminalService {
* Creates a raw terminal instance, this should not be used outside of the terminal part.
*/
createInstance(terminalFocusContextKey: IContextKey<boolean>, configHelper: ITerminalConfigHelper, container: HTMLElement | undefined, shellLaunchConfig: IShellLaunchConfig, doCreateProcess: boolean): ITerminalInstance;
getInstanceFromId(terminalId: number): ITerminalInstance;
getInstanceFromId(terminalId: number): ITerminalInstance | undefined;
getInstanceFromIndex(terminalIndex: number): ITerminalInstance;
getTabLabels(): string[];
getActiveInstance(): ITerminalInstance | null;
@@ -256,9 +279,9 @@ export interface ITerminalService {
findNext(): void;
findPrevious(): void;
selectDefaultWindowsShell(): Promise<void>;
setContainers(panelContainer: HTMLElement, terminalContainer: HTMLElement): void;
getDefaultShell(p: platform.Platform): string;
selectDefaultWindowsShell(): Promise<string | undefined>;
setWorkspaceShellAllowed(isAllowed: boolean): void;
/**
@@ -274,6 +297,28 @@ export interface ITerminalService {
extHostReady(remoteAuthority: string): void;
requestExtHostProcess(proxy: ITerminalProcessExtHostProxy, shellLaunchConfig: IShellLaunchConfig, activeWorkspaceRootUri: URI, cols: number, rows: number, isWorkspaceShellAllowed: boolean): void;
requestVirtualProcess(proxy: ITerminalProcessExtHostProxy, cols: number, rows: number): void;
}
/**
* Provides access to native or electron APIs to other terminal services.
*/
export interface ITerminalNativeService {
_serviceBrand: any;
readonly linuxDistro: LinuxDistro;
readonly onOpenFileRequest: Event<IOpenFileRequest>;
readonly onOsResume: Event<void>;
getWindowsBuildNumber(): number;
whenFileDeleted(path: URI): Promise<void>;
getWslPath(path: string): Promise<string>;
}
export interface IShellDefinition {
label: string;
path: string;
}
export const enum Direction {
@@ -341,6 +386,8 @@ export interface ITerminalInstance {
readonly cols: number;
readonly rows: number;
readonly maxCols: number;
readonly maxRows: number;
/**
* The process ID of the shell process, this is undefined when there is no process associated
@@ -359,12 +406,10 @@ export interface ITerminalInstance {
onDisposed: Event<ITerminalInstance>;
onFocused: Event<ITerminalInstance>;
onProcessIdReady: Event<ITerminalInstance>;
onRequestExtHostProcess: Event<ITerminalInstance>;
onDimensionsChanged: Event<void>;
onMaximumDimensionsChanged: Event<void>;
onFocus: Event<ITerminalInstance>;
@@ -426,7 +471,7 @@ export interface ITerminalInstance {
/**
* Whether to disable layout for the terminal. This is useful when the size of the terminal is
* being manipulating (eg. adding a split pane) and we want the terminal to ignore particular
* being manipulating (e.g. adding a split pane) and we want the terminal to ignore particular
* resize events.
*/
disableLayout: boolean;
@@ -488,7 +533,7 @@ export interface ITerminalInstance {
/**
* Copies the terminal selection to the clipboard.
*/
copySelection(): void;
copySelection(): Promise<void>;
/**
* Current selection in the terminal.
@@ -654,7 +699,7 @@ export interface ITerminalProcessManager extends IDisposable {
readonly ptyProcessReady: Promise<void>;
readonly shellProcessId: number;
readonly remoteAuthority: string | undefined;
readonly os: platform.OperatingSystem | undefined;
readonly os: OperatingSystem | undefined;
readonly userHome: string | undefined;
readonly onProcessReady: Event<void>;
@@ -662,10 +707,10 @@ export interface ITerminalProcessManager extends IDisposable {
readonly onProcessData: Event<string>;
readonly onProcessTitle: Event<string>;
readonly onProcessExit: Event<number>;
readonly onProcessOverrideDimensions: Event<ITerminalDimensions | undefined>;
addDisposable(disposable: IDisposable): void;
dispose(immediate?: boolean): void;
createProcess(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number): void;
createProcess(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number, isScreenReaderModeEnabled: boolean): Promise<void>;
write(data: string): void;
setDimensions(cols: number, rows: number): void;
@@ -698,8 +743,9 @@ export interface ITerminalProcessExtHostProxy extends IDisposable {
emitData(data: string): void;
emitTitle(title: string): void;
emitPid(pid: number): void;
emitReady(pid: number, cwd: string): void;
emitExit(exitCode: number): void;
emitOverrideDimensions(dimensions: ITerminalDimensions | undefined): void;
emitInitialCwd(initialCwd: string): void;
emitCwd(cwd: string): void;
emitLatency(latency: number): void;
@@ -721,6 +767,20 @@ export interface ITerminalProcessExtHostRequest {
isWorkspaceShellAllowed: boolean;
}
export interface ITerminalVirtualProcessRequest {
proxy: ITerminalProcessExtHostProxy;
cols: number;
rows: number;
}
export interface IAvailableShellsRequest {
(shells: IShellDefinition[]): void;
}
export interface IDefaultShellAndArgsRequest {
(shell: string, args: string[] | string | undefined): void;
}
export enum LinuxDistro {
Fedora,
Ubuntu,
@@ -738,8 +798,9 @@ export interface IWindowsShellHelper extends IDisposable {
export interface ITerminalChildProcess {
onProcessData: Event<string>;
onProcessExit: Event<number>;
onProcessIdReady: Event<number>;
onProcessReady: Event<{ pid: number, cwd: string }>;
onProcessTitleChanged: Event<string>;
onProcessOverrideDimensions?: Event<ITerminalDimensions | undefined>;
/**
* Shutdown the terminal process.