提交 6609e798 编写于 作者: R rebornix

💄 switch editor types when pin

上级 6071a17e
......@@ -242,6 +242,8 @@ export class NotebookContribution extends Disposable implements IWorkbenchContri
if (!input!.isDisposed()) {
input?.updateGroup(group.id);
return { override: this.editorService.openEditor(input!, new NotebookEditorOptions(options || {}).with({ ignoreOverrides: true }), group) };
} else {
this._resourceMapping.delete(resource);
}
}
......@@ -276,7 +278,16 @@ export class NotebookContribution extends Disposable implements IWorkbenchContri
input.updateGroup(group.id);
this._resourceMapping.set(resource, input);
return { override: this.editorService.openEditor(input, new NotebookEditorOptions(options || {}).with({ ignoreOverrides: !options?.pinned }), group) };
/**
* Scenario: we are reopening a file editor input which is pinned, we should open in a new editor tab.
*/
let index = undefined;
if (group.activeEditor === originalInput && isEqual(originalInput.resource, resource)) {
const originalEditorIndex = group.getIndexOfEditor(originalInput);
index = group.isPinned(originalInput) ? originalEditorIndex + 1 : originalEditorIndex;
}
return { override: this.editorService.openEditor(input, new NotebookEditorOptions(options || {}).with({ ignoreOverrides: true, index }), group) };
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册