mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 13:46:13 +00:00
Replace editor upon saving (#143144)
This commit is contained in:
parent
a2348fa5f2
commit
69f268f052
|
@ -910,8 +910,16 @@ export class EditorService extends Disposable implements EditorServiceImpl {
|
|||
if (!result.matches(editor)) {
|
||||
const targetGroups = editor.hasCapability(EditorInputCapabilities.Untitled) ? this.editorGroupService.groups.map(group => group.id) /* untitled replaces across all groups */ : [groupId];
|
||||
for (const targetGroup of targetGroups) {
|
||||
const resolvedEditor = await this.editorResolverService.resolveEditor({ resource: result.resource, }, targetGroup);
|
||||
const group = this.editorGroupService.getGroup(targetGroup);
|
||||
await group?.replaceEditors([{ editor, replacement: result, options: editorOptions }]);
|
||||
if (resolvedEditor !== ResolvedStatus.ABORT && isEditorInputWithOptionsAndGroup(resolvedEditor)) {
|
||||
// dispose the previous result before replacing with the resolved editor
|
||||
saveResults.pop()?.dispose();
|
||||
saveResults.push(resolvedEditor.editor);
|
||||
await group?.replaceEditors([{ editor, replacement: resolvedEditor.editor, options: editorOptions }]);
|
||||
} else {
|
||||
await group?.replaceEditors([{ editor, replacement: result, options: editorOptions }]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue