mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-26 01:38:40 +01:00
editor input matches :liptstick:
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
import { AbstractSideBySideEditorInputSerializer, SideBySideEditorInput } from 'vs/workbench/common/editor/sideBySideEditorInput';
|
||||
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
|
||||
import { EditorModel } from 'vs/workbench/common/editor/editorModel';
|
||||
import { TEXT_DIFF_EDITOR_ID, BINARY_DIFF_EDITOR_ID, Verbosity, IEditorDescriptor, IEditorPane, GroupIdentifier, IResourceDiffEditorInput, IEditorInput, IUntypedEditorInput, DEFAULT_EDITOR_ASSOCIATION, UntypedEditorContext, isResourceDiffEditorInput } from 'vs/workbench/common/editor';
|
||||
import { TEXT_DIFF_EDITOR_ID, BINARY_DIFF_EDITOR_ID, Verbosity, IEditorDescriptor, IEditorPane, GroupIdentifier, IResourceDiffEditorInput, IEditorInput, IUntypedEditorInput, DEFAULT_EDITOR_ASSOCIATION, UntypedEditorContext } from 'vs/workbench/common/editor';
|
||||
import { BaseTextEditorModel } from 'vs/workbench/common/editor/textEditorModel';
|
||||
import { DiffEditorModel } from 'vs/workbench/common/editor/diffEditorModel';
|
||||
import { TextDiffEditorModel } from 'vs/workbench/common/editor/textDiffEditorModel';
|
||||
@@ -154,15 +154,15 @@ export class DiffEditorInput extends SideBySideEditorInput {
|
||||
}
|
||||
|
||||
override matches(otherInput: IEditorInput | IUntypedEditorInput): boolean {
|
||||
if (isResourceDiffEditorInput(otherInput)) {
|
||||
return this.modified.matches(otherInput.modified) && this.original.matches(otherInput.original);
|
||||
}
|
||||
|
||||
if (!super.matches(otherInput)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return otherInput instanceof DiffEditorInput && otherInput.forceOpenAsBinary === this.forceOpenAsBinary;
|
||||
if (otherInput instanceof DiffEditorInput && otherInput.forceOpenAsBinary !== this.forceOpenAsBinary) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
override dispose(): void {
|
||||
|
||||
@@ -132,14 +132,15 @@ export class SideBySideEditorInput extends EditorInput implements ISideBySideEdi
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isResourceDiffEditorInput(otherInput)) {
|
||||
return this.primary.matches(otherInput.modified) && this.secondary.matches(otherInput.original);
|
||||
}
|
||||
|
||||
if (otherInput instanceof SideBySideEditorInput) {
|
||||
return this.primary.matches(otherInput.primary) && this.secondary.matches(otherInput.secondary);
|
||||
}
|
||||
|
||||
if (isResourceDiffEditorInput(otherInput)) {
|
||||
// TODO@lramos15 https://github.com/microsoft/vscode/issues/127131
|
||||
return this.primary.matches(otherInput.modified) && this.secondary.matches(otherInput.original);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,14 +107,18 @@ export class NotebookDiffEditorInput extends DiffEditorInput {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isResourceDiffEditorInput(otherInput)) {
|
||||
return this.primary.matches(otherInput.modified) && this.secondary.matches(otherInput.original) && this.editorId !== undefined && this.editorId === otherInput.options?.override;
|
||||
}
|
||||
|
||||
if (otherInput instanceof NotebookDiffEditorInput) {
|
||||
return this.viewType === otherInput.viewType
|
||||
&& isEqual(this.resource, otherInput.resource);
|
||||
}
|
||||
|
||||
if (isResourceDiffEditorInput(otherInput)) {
|
||||
return this.modified.matches(otherInput.modified)
|
||||
&& this.original.matches(otherInput.original)
|
||||
&& this.editorId !== undefined
|
||||
&& this.editorId === otherInput.options?.override;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user