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

@@ -23,7 +23,9 @@ import { coalesce } from 'vs/base/common/arrays';
export const ActiveEditorContext = new RawContextKey<string | null>('activeEditor', null);
export const EditorsVisibleContext = new RawContextKey<boolean>('editorIsOpen', false);
export const EditorPinnedContext = new RawContextKey<boolean>('editorPinned', false);
export const EditorGroupActiveEditorDirtyContext = new RawContextKey<boolean>('groupActiveEditorDirty', false);
export const EditorGroupEditorsCountContext = new RawContextKey<number>('groupEditorsCount', 0);
export const NoEditorsVisibleContext: ContextKeyExpr = EditorsVisibleContext.toNegated();
export const TextCompareEditorVisibleContext = new RawContextKey<boolean>('textCompareEditorVisible', false);
export const TextCompareEditorActiveContext = new RawContextKey<boolean>('textCompareEditorActive', false);
@@ -31,6 +33,7 @@ export const ActiveEditorGroupEmptyContext = new RawContextKey<boolean>('activeE
export const MultipleEditorGroupsContext = new RawContextKey<boolean>('multipleEditorGroups', false);
export const SingleEditorGroupsContext = MultipleEditorGroupsContext.toNegated();
export const InEditorZenModeContext = new RawContextKey<boolean>('inZenMode', false);
export const IsCenteredLayoutContext = new RawContextKey<boolean>('isCenteredLayout', false);
export const SplitEditorsVertically = new RawContextKey<boolean>('splitEditorsVertically', false);
/**
@@ -175,7 +178,7 @@ export interface IEditorInputFactoryRegistry {
*
* @param editorInputId the identifier of the editor input
*/
getEditorInputFactory(editorInputId: string): IEditorInputFactory;
getEditorInputFactory(editorInputId: string): IEditorInputFactory | undefined;
/**
* Starts the registry by providing the required services.
@@ -292,7 +295,7 @@ export interface IEditorInput extends IDisposable {
/**
* Returns the display description of this input.
*/
getDescription(verbosity?: Verbosity): string | null;
getDescription(verbosity?: Verbosity): string | undefined;
/**
* Returns the display title of this input.
@@ -327,13 +330,13 @@ export interface IEditorInput extends IDisposable {
export abstract class EditorInput extends Disposable implements IEditorInput {
protected readonly _onDidChangeDirty: Emitter<void> = this._register(new Emitter<void>());
get onDidChangeDirty(): Event<void> { return this._onDidChangeDirty.event; }
readonly onDidChangeDirty: Event<void> = this._onDidChangeDirty.event;
protected readonly _onDidChangeLabel: Emitter<void> = this._register(new Emitter<void>());
get onDidChangeLabel(): Event<void> { return this._onDidChangeLabel.event; }
readonly onDidChangeLabel: Event<void> = this._onDidChangeLabel.event;
private readonly _onDispose: Emitter<void> = this._register(new Emitter<void>());
get onDispose(): Event<void> { return this._onDispose.event; }
readonly onDispose: Event<void> = this._onDispose.event;
private disposed: boolean = false;
@@ -361,8 +364,8 @@ export abstract class EditorInput extends Disposable implements IEditorInput {
* Returns the description of this input that can be shown to the user. Examples include showing the description of
* the input above the editor area to the side of the name of the input.
*/
getDescription(verbosity?: Verbosity): string | null {
return null;
getDescription(verbosity?: Verbosity): string | undefined {
return undefined;
}
/**
@@ -377,12 +380,12 @@ export abstract class EditorInput extends Disposable implements IEditorInput {
* Returns the preferred editor for this input. A list of candidate editors is passed in that whee registered
* for the input. This allows subclasses to decide late which editor to use for the input on a case by case basis.
*/
getPreferredEditorId(candidates: string[]): string | null {
if (candidates && candidates.length > 0) {
getPreferredEditorId(candidates: string[]): string | undefined {
if (candidates.length > 0) {
return candidates[0];
}
return null;
return undefined;
}
/**
@@ -560,7 +563,7 @@ export class SideBySideEditorInput extends EditorInput {
constructor(
private readonly name: string,
private readonly description: string | null,
private readonly description: string | undefined,
private readonly _details: EditorInput,
private readonly _master: EditorInput
) {
@@ -633,7 +636,7 @@ export class SideBySideEditorInput extends EditorInput {
return this.name;
}
getDescription(): string | null {
getDescription(): string | undefined {
return this.description;
}
@@ -666,7 +669,7 @@ export interface ITextEditorModel extends IEditorModel {
export class EditorModel extends Disposable implements IEditorModel {
private readonly _onDispose: Emitter<void> = this._register(new Emitter<void>());
get onDispose(): Event<void> { return this._onDispose.event; }
readonly onDispose: Event<void> = this._onDispose.event;
/**
* Causes this model to load returning a promise when loading is completed.
@@ -994,7 +997,7 @@ interface IEditorPartConfiguration {
openSideBySideDirection?: 'right' | 'down';
closeEmptyGroups?: boolean;
revealIfOpen?: boolean;
swipeToNavigate?: boolean;
mouseBackForwardToNavigate?: boolean;
labelFormat?: 'default' | 'short' | 'medium' | 'long';
restoreViewState?: boolean;
}
@@ -1058,23 +1061,22 @@ export interface IEditorMemento<T> {
class EditorInputFactoryRegistry implements IEditorInputFactoryRegistry {
private instantiationService: IInstantiationService;
private fileInputFactory: IFileInputFactory;
private editorInputFactoryConstructors: { [editorInputId: string]: IConstructorSignature0<IEditorInputFactory> } = Object.create(null);
private readonly editorInputFactoryInstances: { [editorInputId: string]: IEditorInputFactory } = Object.create(null);
private readonly editorInputFactoryConstructors: Map<string, IConstructorSignature0<IEditorInputFactory>> = new Map();
private readonly editorInputFactoryInstances: Map<string, IEditorInputFactory> = new Map();
start(accessor: ServicesAccessor): void {
this.instantiationService = accessor.get(IInstantiationService);
for (let key in this.editorInputFactoryConstructors) {
const element = this.editorInputFactoryConstructors[key];
this.createEditorInputFactory(key, element);
}
this.editorInputFactoryConstructors.forEach((ctor, key) => {
this.createEditorInputFactory(key, ctor);
});
this.editorInputFactoryConstructors = Object.create(null);
this.editorInputFactoryConstructors.clear();
}
private createEditorInputFactory(editorInputId: string, ctor: IConstructorSignature0<IEditorInputFactory>): void {
const instance = this.instantiationService.createInstance(ctor);
this.editorInputFactoryInstances[editorInputId] = instance;
this.editorInputFactoryInstances.set(editorInputId, instance);
}
registerFileInputFactory(factory: IFileInputFactory): void {
@@ -1087,14 +1089,14 @@ class EditorInputFactoryRegistry implements IEditorInputFactoryRegistry {
registerEditorInputFactory(editorInputId: string, ctor: IConstructorSignature0<IEditorInputFactory>): void {
if (!this.instantiationService) {
this.editorInputFactoryConstructors[editorInputId] = ctor;
this.editorInputFactoryConstructors.set(editorInputId, ctor);
} else {
this.createEditorInputFactory(editorInputId, ctor);
}
}
getEditorInputFactory(editorInputId: string): IEditorInputFactory {
return this.editorInputFactoryInstances[editorInputId];
getEditorInputFactory(editorInputId: string): IEditorInputFactory | undefined {
return this.editorInputFactoryInstances.get(editorInputId);
}
}