Merge from vscode 2b0b9136329c181a9e381463a1f7dc3a2d105a34 (#4880)

This commit is contained in:
Karl Burtram
2019-04-05 10:09:18 -07:00
committed by GitHub
parent 9bd7e30d18
commit cb5bcf2248
433 changed files with 8915 additions and 8361 deletions

View File

@@ -40,7 +40,7 @@ export interface IComposite {
/**
* Returns the underlying control of this composite.
*/
getControl(): ICompositeControl | null;
getControl(): ICompositeControl | undefined;
/**
* Asks the underlying control to focus.

View File

@@ -91,7 +91,7 @@ export interface IEditor {
/**
* Returns the underlying control of this editor.
*/
getControl(): IEditorControl | null;
getControl(): IEditorControl | undefined;
/**
* Asks the underlying control to focus.
@@ -279,7 +279,7 @@ export interface IEditorInput extends IDisposable {
/**
* Returns the associated resource of this input.
*/
getResource(): URI | null;
getResource(): URI | undefined;
/**
* Unique type identifier for this inpput.
@@ -319,7 +319,7 @@ export interface IEditorInput extends IDisposable {
/**
* Returns if the other object matches this input.
*/
matches(other: any): boolean;
matches(other: unknown): boolean;
}
/**
@@ -347,8 +347,8 @@ export abstract class EditorInput extends Disposable implements IEditorInput {
/**
* Returns the associated resource of this input if any.
*/
getResource(): URI | null {
return null;
getResource(): URI | undefined {
return undefined;
}
/**
@@ -392,7 +392,7 @@ export abstract class EditorInput extends Disposable implements IEditorInput {
*
* Subclasses should extend if they can contribute.
*/
getTelemetryDescriptor(): { [key: string]: any } {
getTelemetryDescriptor(): { [key: string]: unknown } {
/* __GDPR__FRAGMENT__
"EditorTelemetryDescriptor" : {
"typeId" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
@@ -453,7 +453,7 @@ export abstract class EditorInput extends Disposable implements IEditorInput {
/**
* Returns true if this input is identical to the otherInput.
*/
matches(otherInput: any): boolean {
matches(otherInput: unknown): boolean {
return this === otherInput;
}
@@ -623,7 +623,7 @@ export class SideBySideEditorInput extends EditorInput {
return this.description;
}
matches(otherInput: any): boolean {
matches(otherInput: unknown): boolean {
if (super.matches(otherInput) === true) {
return true;
}
@@ -684,7 +684,7 @@ export interface IEditorInputWithOptions {
options?: IEditorOptions | ITextEditorOptions;
}
export function isEditorInputWithOptions(obj: any): obj is IEditorInputWithOptions {
export function isEditorInputWithOptions(obj: unknown): obj is IEditorInputWithOptions {
const editorInputWithOptions = obj as IEditorInputWithOptions;
return !!editorInputWithOptions && !!editorInputWithOptions.editor;
@@ -948,7 +948,7 @@ export class EditorCommandsContextActionRunner extends ActionRunner {
super();
}
run(action: IAction, context?: any): Promise<void> {
run(action: IAction): Promise<void> {
return super.run(action, this.context);
}
}
@@ -1007,7 +1007,7 @@ export function toResource(editor: IEditorInput | null | undefined, options?: IR
const resource = editor.getResource();
if (!options || !options.filter) {
return resource; // return early if no filter is specified
return types.withUndefinedAsNull(resource); // return early if no filter is specified
}
if (!resource) {

View File

@@ -72,7 +72,7 @@ export class BinaryEditorModel extends EditorModel {
return this.etag;
}
load(): Promise<EditorModel> {
load(): Promise<BinaryEditorModel> {
// Make sure to resolve up to date stat for file resources
if (this.fileService.canHandleResource(this.resource)) {

View File

@@ -60,10 +60,10 @@ export class DataUriEditorInput extends EditorInput {
}
resolve(): Promise<BinaryEditorModel> {
return this.instantiationService.createInstance(BinaryEditorModel, this.resource, this.getName()).load().then(m => m as BinaryEditorModel);
return this.instantiationService.createInstance(BinaryEditorModel, this.resource, this.getName()).load();
}
matches(otherInput: any): boolean {
matches(otherInput: unknown): boolean {
if (super.matches(otherInput) === true) {
return true;
}

View File

@@ -21,18 +21,20 @@ export class DiffEditorModel extends EditorModel {
this._modifiedModel = modifiedModel;
}
get originalModel(): EditorModel | null {
get originalModel(): IEditorModel | null {
if (!this._originalModel) {
return null;
}
return this._originalModel as EditorModel;
return this._originalModel;
}
get modifiedModel(): EditorModel | null {
get modifiedModel(): IEditorModel | null {
if (!this._modifiedModel) {
return null;
}
return this._modifiedModel as EditorModel;
return this._modifiedModel;
}
load(): Promise<EditorModel> {
@@ -43,7 +45,7 @@ export class DiffEditorModel extends EditorModel {
}
isResolved(): boolean {
return !!this.originalModel && this.originalModel.isResolved() && !!this.modifiedModel && this.modifiedModel.isResolved();
return this.originalModel instanceof EditorModel && this.originalModel.isResolved() && this.modifiedModel instanceof EditorModel && this.modifiedModel.isResolved();
}
dispose(): void {

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { Event, Emitter } from 'vs/base/common/event';
import { Extensions, IEditorInputFactoryRegistry, EditorInput, toResource, IEditorIdentifier, IEditorCloseEvent, GroupIdentifier, SideBySideEditorInput, CloseDirection } from 'vs/workbench/common/editor';
import { Extensions, IEditorInputFactoryRegistry, EditorInput, toResource, IEditorIdentifier, IEditorCloseEvent, GroupIdentifier, SideBySideEditorInput, CloseDirection, IEditorInput } from 'vs/workbench/common/editor';
import { URI } from 'vs/base/common/uri';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
@@ -54,7 +54,7 @@ export interface ISerializedEditorGroup {
}
export function isSerializedEditorGroup(obj?: any): obj is ISerializedEditorGroup {
const group = obj as ISerializedEditorGroup;
const group: ISerializedEditorGroup = obj;
return obj && typeof obj === 'object' && Array.isArray(group.editors) && Array.isArray(group.mru);
}
@@ -146,7 +146,7 @@ export class EditorGroup extends Disposable {
getEditor(index: number): EditorInput | null;
getEditor(resource: URI): EditorInput | null;
getEditor(arg1: any): EditorInput | null {
getEditor(arg1: number | URI): EditorInput | null {
if (typeof arg1 === 'number') {
return this.editors[arg1];
}
@@ -507,7 +507,7 @@ export class EditorGroup extends Disposable {
private splice(index: number, del: boolean, editor?: EditorInput): void {
const editorToDeleteOrReplace = this.editors[index];
const args: any[] = [index, del ? 1 : 0];
const args: (number | EditorInput)[] = [index, del ? 1 : 0];
if (editor) {
args.push(editor);
}
@@ -567,7 +567,7 @@ export class EditorGroup extends Disposable {
}
}
indexOf(candidate: EditorInput | null, editors = this.editors): number {
indexOf(candidate: IEditorInput | null, editors = this.editors): number {
if (!candidate) {
return -1;
}
@@ -620,7 +620,7 @@ export class EditorGroup extends Disposable {
this.mru.unshift(editor);
}
private matches(editorA: EditorInput | null, editorB: EditorInput | null): boolean {
private matches(editorA: IEditorInput | null, editorB: IEditorInput | null): boolean {
return !!editorA && !!editorB && editorA.matches(editorB);
}
@@ -710,10 +710,11 @@ export class EditorGroup extends Disposable {
this.editors = coalesce(data.editors.map(e => {
const factory = registry.getEditorInputFactory(e.id);
if (factory) {
const editor = factory.deserialize(this.instantiationService, e.value)!;
this.registerEditorListeners(editor);
this.updateResourceMap(editor, false /* add */);
const editor = factory.deserialize(this.instantiationService, e.value);
if (editor) {
this.registerEditorListeners(editor);
this.updateResourceMap(editor, false /* add */);
}
// {{SQL CARBON EDIT}}
return CustomInputConverter.convertEditorInput(editor, undefined, this.instantiationService);

View File

@@ -74,14 +74,14 @@ export class ResourceEditorInput extends EditorInput {
ref.dispose();
this.modelReference = null;
return Promise.reject<any>(new Error(`Unexpected model for ResourceInput: ${this.resource}`));
return Promise.reject(new Error(`Unexpected model for ResourceInput: ${this.resource}`));
}
return model;
});
}
matches(otherInput: any): boolean {
matches(otherInput: unknown): boolean {
if (super.matches(otherInput) === true) {
return true;
}

View File

@@ -13,6 +13,10 @@ import { DiffEditorModel } from 'vs/workbench/common/editor/diffEditorModel';
* and the modified version.
*/
export class TextDiffEditorModel extends DiffEditorModel {
protected readonly _originalModel: BaseTextEditorModel;
protected readonly _modifiedModel: BaseTextEditorModel;
private _textDiffEditorModel: IDiffEditorModel | null;
constructor(originalModel: BaseTextEditorModel, modifiedModel: BaseTextEditorModel) {
@@ -22,11 +26,11 @@ export class TextDiffEditorModel extends DiffEditorModel {
}
get originalModel(): BaseTextEditorModel {
return this._originalModel as BaseTextEditorModel;
return this._originalModel;
}
get modifiedModel(): BaseTextEditorModel {
return this._modifiedModel as BaseTextEditorModel;
return this._modifiedModel;
}
load(): Promise<EditorModel> {

View File

@@ -224,7 +224,7 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
return model;
}
matches(otherInput: any): boolean {
matches(otherInput: unknown): boolean {
if (super.matches(otherInput) === true) {
return true;
}

View File

@@ -206,7 +206,7 @@ export interface INotificationViewItem {
equals(item: INotificationViewItem): boolean;
}
export function isNotificationViewItem(obj: any): obj is INotificationViewItem {
export function isNotificationViewItem(obj: unknown): obj is INotificationViewItem {
return obj instanceof NotificationViewItem;
}

View File

@@ -291,6 +291,12 @@ export const STATUS_BAR_ITEM_HOVER_BACKGROUND = registerColor('statusBarItem.hov
hc: Color.white.transparent(0.12)
}, nls.localize('statusBarItemHoverBackground', "Status bar item background color when hovering. The status bar is shown in the bottom of the window."));
export const STATUS_BAR_PROMINENT_ITEM_FOREGROUND = registerColor('statusBarItem.prominentForeground', {
dark: STATUS_BAR_FOREGROUND,
light: STATUS_BAR_FOREGROUND,
hc: STATUS_BAR_FOREGROUND
}, nls.localize('statusBarProminentItemForeground', "Status bar prominent items foreground color. Prominent items stand out from other status bar entries to indicate importance. Change mode `Toggle Tab Key Moves Focus` from command palette to see an example. The status bar is shown in the bottom of the window."));
export const STATUS_BAR_PROMINENT_ITEM_BACKGROUND = registerColor('statusBarItem.prominentBackground', {
dark: Color.black.transparent(0.5),
light: Color.black.transparent(0.5),

View File

@@ -6,7 +6,6 @@
import { IComposite } from 'vs/workbench/common/composite';
import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
export const SidebarVisibleContext = new RawContextKey<boolean>('sidebarVisible', false);
export const SideBarVisibleContext = new RawContextKey<boolean>('sideBarVisible', false);
export const SidebarFocusContext = new RawContextKey<boolean>('sideBarFocus', false);
export const ActiveViewletContext = new RawContextKey<string>('activeViewlet', '');