Revert "Merge from vscode ada4bddb8edc69eea6ebaaa0e88c5f903cbd43d8 (#5529)" (#5553)

This reverts commit 5d44b6a6a7.
This commit is contained in:
Anthony Dresser
2019-05-20 17:07:32 -07:00
committed by GitHub
parent 1315b8e42a
commit c9a4f8f664
325 changed files with 3332 additions and 4501 deletions

View File

@@ -5,7 +5,7 @@
import { Event, Emitter } from 'vs/base/common/event';
import { assign } from 'vs/base/common/objects';
import { isUndefinedOrNull } from 'vs/base/common/types';
import { isUndefinedOrNull, withUndefinedAsNull } from 'vs/base/common/types';
import { URI } from 'vs/base/common/uri';
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import { IEditor as ICodeEditor, IEditorViewState, ScrollType, IDiffEditor } from 'vs/editor/common/editorCommon';
@@ -144,7 +144,7 @@ export interface IEditorControl extends ICompositeControl { }
export interface IFileInputFactory {
createFileInput(resource: URI, encoding: string | undefined, mode: string | undefined, instantiationService: IInstantiationService): IFileEditorInput;
createFileInput(resource: URI, encoding: string | undefined, instantiationService: IInstantiationService): IFileEditorInput;
isFileInput(obj: any): obj is IFileEditorInput;
}
@@ -209,7 +209,7 @@ export interface IUntitledResourceInput extends IBaseResourceInput {
/**
* Optional language of the untitled resource.
*/
mode?: string;
language?: string;
/**
* Optional contents of the untitled resource.
@@ -516,35 +516,19 @@ export interface IEncodingSupport {
setEncoding(encoding: string, mode: EncodingMode): void;
}
export interface IModeSupport {
/**
* Sets the language mode of the input.
*/
setMode(mode: string): void;
}
/**
* This is a tagging interface to declare an editor input being capable of dealing with files. It is only used in the editor registry
* to register this kind of input to the platform.
*/
export interface IFileEditorInput extends IEditorInput, IEncodingSupport, IModeSupport {
export interface IFileEditorInput extends IEditorInput, IEncodingSupport {
/**
* Gets the resource this editor is about.
*/
getResource(): URI;
/**
* Sets the preferred encoding to use for this input.
* Sets the preferred encodingt to use for this input.
*/
setPreferredEncoding(encoding: string): void;
/**
* Sets the preferred language mode to use for this input.
*/
setPreferredMode(mode: string): void;
/**
* Forces this file input to open as binary instead of text.
*/
@@ -593,7 +577,7 @@ export class SideBySideEditorInput extends EditorInput {
return this.master.revert();
}
getTelemetryDescriptor(): { [key: string]: unknown } {
getTelemetryDescriptor(): object {
const descriptor = this.master.getTelemetryDescriptor();
return assign(descriptor, super.getTelemetryDescriptor());
@@ -647,7 +631,8 @@ export class SideBySideEditorInput extends EditorInput {
return false;
}
return this.details.matches(otherInput.details) && this.master.matches(otherInput.master);
const otherDiffInput = <SideBySideEditorInput>otherInput;
return this.details.matches(otherDiffInput.details) && this.master.matches(otherDiffInput.master);
}
return false;
@@ -1013,9 +998,9 @@ export interface IResourceOptions {
filterByScheme?: string | string[];
}
export function toResource(editor: IEditorInput | undefined, options?: IResourceOptions): URI | undefined {
export function toResource(editor: IEditorInput | null | undefined, options?: IResourceOptions): URI | null {
if (!editor) {
return undefined;
return null;
}
if (options && options.supportSideBySide && editor instanceof SideBySideEditorInput) {
@@ -1024,7 +1009,7 @@ export function toResource(editor: IEditorInput | undefined, options?: IResource
const resource = editor.getResource();
if (!resource || !options || !options.filterByScheme) {
return resource;
return withUndefinedAsNull(resource);
}
if (Array.isArray(options.filterByScheme) && options.filterByScheme.some(scheme => resource.scheme === scheme)) {
@@ -1035,7 +1020,7 @@ export function toResource(editor: IEditorInput | undefined, options?: IResource
return resource;
}
return undefined;
return null;
}
export const enum CloseDirection {