Merge from vscode 2cd495805cf99b31b6926f08ff4348124b2cf73d

This commit is contained in:
ADS Merger
2020-06-30 04:40:21 +00:00
committed by AzureDataStudio
parent a8a7559229
commit 1388493cc1
602 changed files with 16375 additions and 12940 deletions

View File

@@ -649,10 +649,16 @@ export interface IModeSupport {
export interface IFileEditorInput extends IEditorInput, IEncodingSupport, IModeSupport {
/**
* Gets the resource this editor is about.
* Gets the resource this file input is about.
*/
readonly resource: URI;
/**
* Gets the label of the editor. In most cases this will
* be identical to the resource.
*/
readonly label: URI;
/**
* Sets the preferred label to use for this file input.
*/
@@ -680,7 +686,7 @@ export interface IFileEditorInput extends IEditorInput, IEncodingSupport, IModeS
}
/**
* Side by side editor inputs that have a master and details side.
* Side by side editor inputs that have a primary and secondary side.
*/
export class SideBySideEditorInput extends EditorInput {
@@ -689,8 +695,8 @@ export class SideBySideEditorInput extends EditorInput {
constructor(
protected readonly name: string | undefined,
private readonly description: string | undefined,
private readonly _details: EditorInput,
private readonly _master: EditorInput
private readonly _secondary: EditorInput,
private readonly _primary: EditorInput
) {
super();
@@ -699,36 +705,36 @@ export class SideBySideEditorInput extends EditorInput {
private registerListeners(): void {
// When the details or master input gets disposed, dispose this diff editor input
const onceDetailsDisposed = Event.once(this.details.onDispose);
this._register(onceDetailsDisposed(() => {
// When the primary or secondary input gets disposed, dispose this diff editor input
const onceSecondaryDisposed = Event.once(this.secondary.onDispose);
this._register(onceSecondaryDisposed(() => {
if (!this.isDisposed()) {
this.dispose();
}
}));
const onceMasterDisposed = Event.once(this.master.onDispose);
this._register(onceMasterDisposed(() => {
const oncePrimaryDisposed = Event.once(this.primary.onDispose);
this._register(oncePrimaryDisposed(() => {
if (!this.isDisposed()) {
this.dispose();
}
}));
// Reemit some events from the master side to the outside
this._register(this.master.onDidChangeDirty(() => this._onDidChangeDirty.fire()));
this._register(this.master.onDidChangeLabel(() => this._onDidChangeLabel.fire()));
// Reemit some events from the primary side to the outside
this._register(this.primary.onDidChangeDirty(() => this._onDidChangeDirty.fire()));
this._register(this.primary.onDidChangeLabel(() => this._onDidChangeLabel.fire()));
}
get resource(): URI | undefined {
return undefined;
}
get master(): EditorInput {
return this._master;
get primary(): EditorInput {
return this._primary;
}
get details(): EditorInput {
return this._details;
get secondary(): EditorInput {
return this._secondary;
}
getTypeId(): string {
@@ -737,7 +743,7 @@ export class SideBySideEditorInput extends EditorInput {
getName(): string {
if (!this.name) {
return localize('sideBySideLabels', "{0} - {1}", this._details.getName(), this._master.getName());
return localize('sideBySideLabels', "{0} - {1}", this._secondary.getName(), this._primary.getName());
}
return this.name;
@@ -748,50 +754,46 @@ export class SideBySideEditorInput extends EditorInput {
}
isReadonly(): boolean {
return this.master.isReadonly();
return this.primary.isReadonly();
}
isUntitled(): boolean {
return this.master.isUntitled();
return this.primary.isUntitled();
}
isDirty(): boolean {
return this.master.isDirty();
return this.primary.isDirty();
}
isSaving(): boolean {
return this.master.isSaving();
return this.primary.isSaving();
}
save(group: GroupIdentifier, options?: ISaveOptions): Promise<IEditorInput | undefined> {
return this.master.save(group, options);
return this.primary.save(group, options);
}
saveAs(group: GroupIdentifier, options?: ISaveOptions): Promise<IEditorInput | undefined> {
return this.master.saveAs(group, options);
return this.primary.saveAs(group, options);
}
revert(group: GroupIdentifier, options?: IRevertOptions): Promise<void> {
return this.master.revert(group, options);
return this.primary.revert(group, options);
}
getTelemetryDescriptor(): { [key: string]: unknown } {
const descriptor = this.master.getTelemetryDescriptor();
const descriptor = this.primary.getTelemetryDescriptor();
return Object.assign(descriptor, super.getTelemetryDescriptor());
}
matches(otherInput: unknown): boolean {
if (super.matches(otherInput) === true) {
if (otherInput === this) {
return true;
}
if (otherInput) {
if (!(otherInput instanceof SideBySideEditorInput)) {
return false;
}
return this.details.matches(otherInput.details) && this.master.matches(otherInput.master);
if (otherInput instanceof SideBySideEditorInput) {
return this.primary.matches(otherInput.primary) && this.secondary.matches(otherInput.secondary);
}
return false;
@@ -1210,8 +1212,8 @@ export interface IEditorPartOptionsChangeEvent {
}
export enum SideBySideEditor {
MASTER = 1,
DETAILS = 2,
PRIMARY = 1,
SECONDARY = 2,
BOTH = 3
}
@@ -1221,9 +1223,9 @@ export interface IResourceOptions {
}
export function toResource(editor: IEditorInput | undefined | null): URI | undefined;
export function toResource(editor: IEditorInput | undefined | null, options: IResourceOptions & { supportSideBySide?: SideBySideEditor.MASTER | SideBySideEditor.DETAILS }): URI | undefined;
export function toResource(editor: IEditorInput | undefined | null, options: IResourceOptions & { supportSideBySide: SideBySideEditor.BOTH }): URI | { master?: URI, detail?: URI } | undefined;
export function toResource(editor: IEditorInput | undefined | null, options?: IResourceOptions): URI | { master?: URI, detail?: URI } | undefined {
export function toResource(editor: IEditorInput | undefined | null, options: IResourceOptions & { supportSideBySide?: SideBySideEditor.PRIMARY | SideBySideEditor.SECONDARY }): URI | undefined;
export function toResource(editor: IEditorInput | undefined | null, options: IResourceOptions & { supportSideBySide: SideBySideEditor.BOTH }): URI | { primary?: URI, secondary?: URI } | undefined;
export function toResource(editor: IEditorInput | undefined | null, options?: IResourceOptions): URI | { primary?: URI, secondary?: URI } | undefined {
if (!editor) {
return undefined;
}
@@ -1231,12 +1233,12 @@ export function toResource(editor: IEditorInput | undefined | null, options?: IR
if (options?.supportSideBySide && editor instanceof SideBySideEditorInput) {
if (options?.supportSideBySide === SideBySideEditor.BOTH) {
return {
master: toResource(editor.master, { filterByScheme: options.filterByScheme }),
detail: toResource(editor.details, { filterByScheme: options.filterByScheme })
primary: toResource(editor.primary, { filterByScheme: options.filterByScheme }),
secondary: toResource(editor.secondary, { filterByScheme: options.filterByScheme })
};
}
editor = options.supportSideBySide === SideBySideEditor.MASTER ? editor.master : editor.details;
editor = options.supportSideBySide === SideBySideEditor.PRIMARY ? editor.primary : editor.secondary;
}
const resource = editor.resource;