Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463 (#7206)

* Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463

* fix config changes

* fix strictnull checks
This commit is contained in:
Anthony Dresser
2019-09-15 22:38:26 -07:00
committed by GitHub
parent fa6c52699e
commit ea0f9e6ce9
1226 changed files with 21541 additions and 17633 deletions

View File

@@ -15,7 +15,7 @@ export interface IComposite {
/**
* Returns the name of this composite to show in the title area.
*/
getTitle(): string | null;
getTitle(): string | undefined;
/**
* Returns the primary actions of the composite.

View File

@@ -22,6 +22,7 @@ import { IPathData } from 'vs/platform/windows/common/windows';
import { coalesce } from 'vs/base/common/arrays';
export const ActiveEditorContext = new RawContextKey<string | null>('activeEditor', null);
export const ActiveEditorIsSaveableContext = new RawContextKey<boolean>('activeEditorIsSaveable', false);
export const EditorsVisibleContext = new RawContextKey<boolean>('editorIsOpen', false);
export const EditorPinnedContext = new RawContextKey<boolean>('editorPinned', false);
export const EditorGroupActiveEditorDirtyContext = new RawContextKey<boolean>('groupActiveEditorDirty', false);
@@ -30,7 +31,7 @@ export const NoEditorsVisibleContext: ContextKeyExpr = EditorsVisibleContext.toN
export const TextCompareEditorVisibleContext = new RawContextKey<boolean>('textCompareEditorVisible', false);
export const TextCompareEditorActiveContext = new RawContextKey<boolean>('textCompareEditorActive', false);
export const ActiveEditorGroupEmptyContext = new RawContextKey<boolean>('activeEditorGroupEmpty', false);
export const ActiveEditorGroupIndexContext = new RawContextKey<number>('activeEditorGroupIndex', -1);
export const ActiveEditorGroupIndexContext = new RawContextKey<number>('activeEditorGroupIndex', 0);
export const ActiveEditorGroupLastContext = new RawContextKey<boolean>('activeEditorGroupLast', false);
export const MultipleEditorGroupsContext = new RawContextKey<boolean>('multipleEditorGroups', false);
export const SingleEditorGroupsContext = MultipleEditorGroupsContext.toNegated();
@@ -53,12 +54,12 @@ export interface IEditor {
/**
* The assigned input of this editor.
*/
input: IEditorInput | null;
input: IEditorInput | undefined;
/**
* The assigned options of this editor.
*/
options: IEditorOptions | null;
options: IEditorOptions | undefined;
/**
* The assigned group this editor is showing in.
@@ -292,7 +293,7 @@ export interface IEditorInput extends IDisposable {
/**
* Returns the display name of this input.
*/
getName(): string | null;
getName(): string | undefined;
/**
* Returns the display description of this input.
@@ -302,7 +303,7 @@ export interface IEditorInput extends IDisposable {
/**
* Returns the display title of this input.
*/
getTitle(verbosity?: Verbosity): string | null;
getTitle(verbosity?: Verbosity): string | undefined;
/**
* Resolves the input.
@@ -358,8 +359,8 @@ export abstract class EditorInput extends Disposable implements IEditorInput {
* Returns the name of this input that can be shown to the user. Examples include showing the name of the input
* above the editor area when the input is shown.
*/
getName(): string | null {
return null;
getName(): string | undefined {
return undefined;
}
/**
@@ -374,7 +375,7 @@ export abstract class EditorInput extends Disposable implements IEditorInput {
* Returns the title of this input that can be shown to the user. Examples include showing the title of
* the input above the editor area as hover over the input label.
*/
getTitle(verbosity?: Verbosity): string | null {
getTitle(verbosity?: Verbosity): string | undefined {
return this.getName();
}
@@ -733,7 +734,8 @@ export class EditorOptions implements IEditorOptions {
/**
* This option is only relevant if an editor is opened into a group that is not active
* already and allows to control if the inactive group should become active or not.
* already and allows to control if the inactive group should become active, restored
* or preserved.
*
* By default, the editor group will become active unless `preserveFocus` or `inactive`
* is specified.
@@ -783,6 +785,11 @@ export class EditorOptions implements IEditorOptions {
*/
ignoreError: boolean | undefined;
/**
* Does not use editor overrides while opening the editor.
*/
ignoreOverrides: boolean | undefined;
/**
* Overwrites option values from the provided bag.
*/
@@ -823,6 +830,10 @@ export class EditorOptions implements IEditorOptions {
this.index = options.index;
}
if (typeof options.ignoreOverrides === 'boolean') {
this.ignoreOverrides = options.ignoreOverrides;
}
return this;
}
}

View File

@@ -8,7 +8,6 @@ import { URI } from 'vs/base/common/uri';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel';
import { DataUri } from 'vs/base/common/resources';
import { withUndefinedAsNull } from 'vs/base/common/types';
/**
* An editor input to present data URIs in a binary editor. Data URIs have the form of:
@@ -51,8 +50,8 @@ export class DataUriEditorInput extends EditorInput {
return DataUriEditorInput.ID;
}
getName(): string | null {
return withUndefinedAsNull(this.name);
getName(): string | undefined {
return this.name;
}
getDescription(): string | undefined {

View File

@@ -16,7 +16,7 @@ export class DiffEditorInput extends SideBySideEditorInput {
static readonly ID = 'workbench.editors.diffEditorInput';
private cachedModel: DiffEditorModel | null;
private cachedModel: DiffEditorModel | null = null;
constructor(name: string, description: string | undefined, original: EditorInput, modified: EditorInput, private readonly forceOpenAsBinary?: boolean) {
super(name, description, original, modified);
@@ -86,4 +86,4 @@ export class DiffEditorInput extends SideBySideEditorInput {
super.dispose();
}
}
}

View File

@@ -96,16 +96,17 @@ export class EditorGroup extends Disposable {
//#endregion
private _id: GroupIdentifier;
get id(): GroupIdentifier { return this._id; }
private editors: EditorInput[] = [];
private mru: EditorInput[] = [];
private mapResourceToEditorCount: ResourceMap<number> = new ResourceMap<number>();
private preview: EditorInput | null; // editor in preview state
private active: EditorInput | null; // editor in active state
private preview: EditorInput | null = null; // editor in preview state
private active: EditorInput | null = null; // editor in active state
private editorOpenPositioning: 'left' | 'right' | 'first' | 'last';
private focusRecentEditorAfterClose: boolean;
private editorOpenPositioning: ('left' | 'right' | 'first' | 'last') | undefined;
private focusRecentEditorAfterClose: boolean | undefined;
constructor(
labelOrSerializedGroup: ISerializedEditorGroup,
@@ -115,7 +116,7 @@ export class EditorGroup extends Disposable {
super();
if (isSerializedEditorGroup(labelOrSerializedGroup)) {
this.deserialize(labelOrSerializedGroup);
this._id = this.deserialize(labelOrSerializedGroup);
} else {
this._id = EditorGroup.IDS++;
}
@@ -133,10 +134,6 @@ export class EditorGroup extends Disposable {
this.focusRecentEditorAfterClose = this.configurationService.getValue('workbench.editor.focusRecentEditorAfterClose');
}
get id(): GroupIdentifier {
return this._id;
}
get count(): number {
return this.editors.length;
}
@@ -697,7 +694,7 @@ export class EditorGroup extends Disposable {
};
}
private deserialize(data: ISerializedEditorGroup): void {
private deserialize(data: ISerializedEditorGroup): number {
const registry = Registry.as<IEditorInputFactoryRegistry>(Extensions.EditorInputFactories);
if (typeof data.id === 'number') {
@@ -723,11 +720,16 @@ export class EditorGroup extends Disposable {
return null;
}));
this.mru = data.mru.map(i => this.editors[i]);
this.active = this.mru[0];
if (typeof data.preview === 'number') {
this.preview = this.editors[data.preview];
}
return this._id;
}
// {{SQL CARBON EDIT}}

View File

@@ -17,8 +17,8 @@ export class ResourceEditorInput extends EditorInput implements IModeSupport {
static readonly ID: string = 'workbench.editors.resourceEditorInput';
private cachedModel: ResourceEditorModel | null;
private modelReference: Promise<IReference<ITextEditorModel>> | null;
private cachedModel: ResourceEditorModel | null = null;
private modelReference: Promise<IReference<ITextEditorModel>> | null = null;
constructor(
private name: string,

View File

@@ -14,10 +14,10 @@ import { DiffEditorModel } from 'vs/workbench/common/editor/diffEditorModel';
*/
export class TextDiffEditorModel extends DiffEditorModel {
protected readonly _originalModel: BaseTextEditorModel;
protected readonly _modifiedModel: BaseTextEditorModel;
protected readonly _originalModel!: BaseTextEditorModel | null;
protected readonly _modifiedModel!: BaseTextEditorModel | null;
private _textDiffEditorModel: IDiffEditorModel | null;
private _textDiffEditorModel: IDiffEditorModel | null = null;
constructor(originalModel: BaseTextEditorModel, modifiedModel: BaseTextEditorModel) {
super(originalModel, modifiedModel);
@@ -25,11 +25,11 @@ export class TextDiffEditorModel extends DiffEditorModel {
this.updateTextDiffEditorModel();
}
get originalModel(): BaseTextEditorModel {
get originalModel(): BaseTextEditorModel | null {
return this._originalModel;
}
get modifiedModel(): BaseTextEditorModel {
get modifiedModel(): BaseTextEditorModel | null {
return this._modifiedModel;
}
@@ -42,7 +42,7 @@ export class TextDiffEditorModel extends DiffEditorModel {
}
private updateTextDiffEditorModel(): void {
if (this.originalModel.isResolved() && this.modifiedModel.isResolved()) {
if (this.originalModel && this.originalModel.isResolved() && this.modifiedModel && this.modifiedModel.isResolved()) {
// Create new
if (!this._textDiffEditorModel) {
@@ -69,7 +69,7 @@ export class TextDiffEditorModel extends DiffEditorModel {
}
isReadonly(): boolean {
return this.modifiedModel.isReadonly();
return !!this.modifiedModel && this.modifiedModel.isReadonly();
}
dispose(): void {

View File

@@ -23,8 +23,8 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
static readonly ID: string = 'workbench.editors.untitledEditorInput';
private cachedModel: UntitledEditorModel | null;
private modelResolve: Promise<UntitledEditorModel & IResolvedTextEditorModel> | null;
private cachedModel: UntitledEditorModel | null = null;
private modelResolve: Promise<UntitledEditorModel & IResolvedTextEditorModel> | null = null;
private readonly _onDidModelChangeContent: Emitter<void> = this._register(new Emitter<void>());
readonly onDidModelChangeContent: Event<void> = this._onDidModelChangeContent.event;
@@ -107,7 +107,7 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
return this.labelService.getUriLabel(this.resource);
}
getTitle(verbosity: Verbosity): string | null {
getTitle(verbosity: Verbosity): string | undefined {
if (!this.hasAssociatedFilePath) {
return this.getName();
}
@@ -121,7 +121,7 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
return this.longTitle;
}
return null;
return undefined;
}
isDirty(): boolean {

View File

@@ -383,13 +383,13 @@ export const EXTENSION_BADGE_REMOTE_BACKGROUND = registerColor('extensionBadge.r
dark: ACTIVITY_BAR_BADGE_BACKGROUND,
light: ACTIVITY_BAR_BADGE_BACKGROUND,
hc: ACTIVITY_BAR_BADGE_BACKGROUND
}, nls.localize('extensionBadge.remoteBackground', "Background color for the remote badge in the extensions view"));
}, nls.localize('extensionBadge.remoteBackground', "Background color for the remote badge in the extensions view."));
export const EXTENSION_BADGE_REMOTE_FOREGROUND = registerColor('extensionBadge.remoteForeground', {
dark: ACTIVITY_BAR_BADGE_FOREGROUND,
light: ACTIVITY_BAR_BADGE_FOREGROUND,
hc: ACTIVITY_BAR_BADGE_FOREGROUND
}, nls.localize('extensionBadge.remoteForeground', "Foreground color for the remote badge in the extensions view"));
}, nls.localize('extensionBadge.remoteForeground', "Foreground color for the remote badge in the extensions view."));
// < --- Side Bar --- >
@@ -449,13 +449,13 @@ export const QUICK_INPUT_BACKGROUND = registerColor('quickInput.background', {
dark: SIDE_BAR_BACKGROUND,
light: SIDE_BAR_BACKGROUND,
hc: SIDE_BAR_BACKGROUND
}, nls.localize('quickInputBackground', "Quick Input background color. The Quick Input widget is the container for views like the color theme picker"));
}, nls.localize('quickInputBackground', "Quick Input background color. The Quick Input widget is the container for views like the color theme picker."));
export const QUICK_INPUT_FOREGROUND = registerColor('quickInput.foreground', {
dark: SIDE_BAR_FOREGROUND,
light: SIDE_BAR_FOREGROUND,
hc: SIDE_BAR_FOREGROUND
}, nls.localize('quickInputForeground', "Quick Input foreground color. The Quick Input widget is the container for views like the color theme picker"));
}, nls.localize('quickInputForeground', "Quick Input foreground color. The Quick Input widget is the container for views like the color theme picker."));
// < --- Title Bar --- >

View File

@@ -10,7 +10,7 @@ import { ContextKeyExpr, RawContextKey } from 'vs/platform/contextkey/common/con
import { ITreeViewDataProvider } from 'vs/workbench/common/views';
import { localize } from 'vs/nls';
import { IViewlet } from 'vs/workbench/common/viewlet';
import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
import { values, keys } from 'vs/base/common/map';
@@ -295,7 +295,7 @@ export interface IViewsViewlet extends IViewlet {
export const IViewsService = createDecorator<IViewsService>('viewsService');
export interface IViewsService {
_serviceBrand: ServiceIdentifier<any>;
_serviceBrand: undefined;
openView(id: string, focus?: boolean): Promise<IView | null>;
@@ -314,6 +314,8 @@ export interface ITreeView extends IDisposable {
message?: string;
title: string;
readonly visible: boolean;
readonly onDidExpandItem: Event<ITreeItem>;
@@ -326,6 +328,8 @@ export interface ITreeView extends IDisposable {
readonly onDidChangeActions: Event<void>;
readonly onDidChangeTitle: Event<string>;
refresh(treeItems?: ITreeItem[]): Promise<void>;
setVisibility(visible: boolean): void;