Fix #121793
This commit is contained in:
parent
1b1fa41158
commit
b0b4b814d0
3 changed files with 16 additions and 17 deletions
|
@ -23,6 +23,7 @@ import { AllEditorsByMostRecentlyUsedQuickAccess, ActiveGroupEditorsByMostRecent
|
|||
import { Codicon } from 'vs/base/common/codicons';
|
||||
import { IFilesConfigurationService, AutoSaveMode } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
|
||||
import { EditorOverride } from 'vs/platform/editor/common/editor';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
|
||||
export class ExecuteCommandAction extends Action {
|
||||
|
||||
|
@ -1913,7 +1914,14 @@ export class ReopenResourcesAction extends Action {
|
|||
|
||||
const options = activeEditorPane.options;
|
||||
const group = activeEditorPane.group;
|
||||
await this.editorService.openEditor(activeInput, { ...options, override: EditorOverride.PICK }, group);
|
||||
await this.editorService.replaceEditors([
|
||||
{
|
||||
editor: activeInput,
|
||||
replacement: activeInput,
|
||||
forceReplaceDirty: activeInput.resource?.scheme === Schemas.untitled,
|
||||
options: { ...options, override: EditorOverride.PICK }
|
||||
}
|
||||
], group);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import { basename, extname, isEqual } from 'vs/base/common/resources';
|
|||
import { URI } from 'vs/base/common/uri';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { EditorActivation, EditorOverride, IEditorOptions, ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { EditorOptions, EditorResourceAccessor, IEditorInput, IEditorInputWithOptions, IEditorInputWithOptionsAndGroup } from 'vs/workbench/common/editor';
|
||||
import { EditorResourceAccessor, IEditorInput, IEditorInputWithOptions, IEditorInputWithOptionsAndGroup } from 'vs/workbench/common/editor';
|
||||
import { IEditorGroup, IEditorGroupsService, preferredSideBySideGroupDirection } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
|
||||
|
@ -234,19 +234,6 @@ export class EditorOverrideService extends Disposable implements IEditorOverride
|
|||
this.closeExistingEditorsForResource(resource, selectedContribution.editorInfo.id, group);
|
||||
}
|
||||
|
||||
// If an existing editor for a resource exists within the group and we're reopening it, replace it.
|
||||
const existing = firstOrDefault(group.findEditors(resource));
|
||||
if (existing) {
|
||||
if (!input.matches(existing)) {
|
||||
await group.replaceEditors([{
|
||||
editor: existing,
|
||||
replacement: input,
|
||||
forceReplaceDirty: existing.resource?.scheme === Schemas.untitled,
|
||||
options: options ? EditorOptions.create(options) : undefined,
|
||||
}]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return { editor: input };
|
||||
}
|
||||
|
||||
|
|
|
@ -877,11 +877,16 @@ export class EditorService extends Disposable implements EditorServiceImpl {
|
|||
async replaceEditors(editors: IEditorReplacement[], group: IEditorGroup | GroupIdentifier): Promise<void>;
|
||||
async replaceEditors(editors: Array<IEditorReplacement | IResourceEditorReplacement>, group: IEditorGroup | GroupIdentifier): Promise<void> {
|
||||
const typedEditors: IEditorReplacement[] = [];
|
||||
const targetGroup = typeof group === 'number' ? this.editorGroupService.getGroup(group) : group;
|
||||
|
||||
for (const replaceEditorArg of editors) {
|
||||
if (replaceEditorArg.editor instanceof EditorInput) {
|
||||
const replacementArg = replaceEditorArg as IEditorReplacement;
|
||||
|
||||
if (replacementArg.options?.override !== EditorOverride.DISABLED && targetGroup) {
|
||||
const override = await this.editorOverrideService.resolveEditorOverride(replacementArg.replacement, replacementArg.options, targetGroup);
|
||||
replacementArg.options = override?.options ?? replacementArg.options;
|
||||
replacementArg.replacement = override?.editor ?? replacementArg.replacement;
|
||||
}
|
||||
typedEditors.push({
|
||||
editor: replacementArg.editor,
|
||||
replacement: replacementArg.replacement,
|
||||
|
@ -899,7 +904,6 @@ export class EditorService extends Disposable implements EditorServiceImpl {
|
|||
}
|
||||
}
|
||||
|
||||
const targetGroup = typeof group === 'number' ? this.editorGroupService.getGroup(group) : group;
|
||||
if (targetGroup) {
|
||||
return targetGroup.replaceEditors(typedEditors);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue