Better active editor check logic

This commit is contained in:
Logan Ramos 2021-06-14 10:19:05 -04:00
parent f1bbe6611d
commit 59ccce16da
No known key found for this signature in database
GPG key ID: D9CCFF14F0B18183

View file

@ -124,12 +124,9 @@ export class EditorOverrideService extends Disposable implements IEditorOverride
}
// If it's the currently active editor we shouldn't do anything
const currentEditor = firstOrDefault(group.findEditors(resource));
let currentViewType = undefined;
if (currentEditor) {
currentViewType = (currentEditor as IRegisteredEditorInput).viewType;
}
if (currentViewType && selectedEditor.editorInfo.id === currentViewType) {
const currentEditors = group.findEditors(resource);
const isActive = currentEditors.find(editor => (editor as IRegisteredEditorInput).viewType === selectedEditor.editorInfo.id);
if (isActive) {
return OverrideStatus.ABORT;
}
const input = await this.doOverrideEditorInput(resource, editor, options, group, selectedEditor);