Merge from vscode 4636be2b71c87bfb0bfe3c94278b447a5efcc1f1 (#8722)

* Merge from vscode 4636be2b71c87bfb0bfe3c94278b447a5efcc1f1

* remove tests that aren't working
This commit is contained in:
Anthony Dresser
2019-12-18 00:14:28 -08:00
committed by GitHub
parent 0fd870d156
commit 30d9e9c141
289 changed files with 5537 additions and 3039 deletions

View File

@@ -7,7 +7,7 @@ import { Event, Emitter } from 'vs/base/common/event';
import { assign } from 'vs/base/common/objects';
import { isUndefinedOrNull, withNullAsUndefined, assertIsDefined } from 'vs/base/common/types';
import { URI } from 'vs/base/common/uri';
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import { IDisposable, Disposable, toDisposable } from 'vs/base/common/lifecycle';
import { IEditor as ICodeEditor, IEditorViewState, ScrollType, IDiffEditor } from 'vs/editor/common/editorCommon';
import { IEditorModel, IEditorOptions, ITextEditorOptions, IBaseResourceInput, IResourceInput, EditorActivation, EditorOpenContext } from 'vs/platform/editor/common/editor';
import { IInstantiationService, IConstructorSignature0, ServicesAccessor, BrandedService } from 'vs/platform/instantiation/common/instantiation';
@@ -181,7 +181,7 @@ export interface IEditorInputFactoryRegistry {
* @param editorInputId the identifier of the editor input
* @param factory the editor input factory for serialization/deserialization
*/
registerEditorInputFactory<Services extends BrandedService[]>(editorInputId: string, ctor: { new(...Services: Services): IEditorInputFactory }): void;
registerEditorInputFactory<Services extends BrandedService[]>(editorInputId: string, ctor: { new(...Services: Services): IEditorInputFactory }): IDisposable;
/**
* Returns the editor input factory for the given editor input.
@@ -198,6 +198,11 @@ export interface IEditorInputFactoryRegistry {
export interface IEditorInputFactory {
/**
* Determines wether the given editor input can be serialized by the factory.
*/
canSerialize(editorInput: IEditorInput): boolean;
/**
* Returns a string representation of the provided editor input that contains enough information
* to deserialize back to the original editor input from the deserialize() method.
@@ -613,12 +618,12 @@ export const enum EncodingMode {
export interface IEncodingSupport {
/**
* Gets the encoding of the input if known.
* Gets the encoding of the type if known.
*/
getEncoding(): string | undefined;
/**
* Sets the encoding for the input for saving.
* Sets the encoding for the type for saving.
*/
setEncoding(encoding: string, mode: EncodingMode): void;
}
@@ -626,7 +631,7 @@ export interface IEncodingSupport {
export interface IModeSupport {
/**
* Sets the language mode of the input.
* Sets the language mode of the type.
*/
setMode(mode: string): void;
}
@@ -1227,6 +1232,7 @@ export interface IEditorMemento<T> {
class EditorInputFactoryRegistry implements IEditorInputFactoryRegistry {
private instantiationService: IInstantiationService | undefined;
private fileInputFactory: IFileInputFactory | undefined;
private readonly editorInputFactoryConstructors: Map<string, IConstructorSignature0<IEditorInputFactory>> = new Map();
private readonly editorInputFactoryInstances: Map<string, IEditorInputFactory> = new Map();
@@ -1253,12 +1259,18 @@ class EditorInputFactoryRegistry implements IEditorInputFactoryRegistry {
return assertIsDefined(this.fileInputFactory);
}
registerEditorInputFactory(editorInputId: string, ctor: IConstructorSignature0<IEditorInputFactory>): void {
registerEditorInputFactory(editorInputId: string, ctor: IConstructorSignature0<IEditorInputFactory>): IDisposable {
if (!this.instantiationService) {
this.editorInputFactoryConstructors.set(editorInputId, ctor);
} else {
this.createEditorInputFactory(editorInputId, ctor, this.instantiationService);
}
return toDisposable(() => {
this.editorInputFactoryConstructors.delete(editorInputId);
this.editorInputFactoryInstances.delete(editorInputId);
});
}
getEditorInputFactory(editorInputId: string): IEditorInputFactory | undefined {