提交 5d37bb76 编写于 作者: B Benjamin Pasero

better fix for #97584 without flicker

上级 9e7842d9
......@@ -5,7 +5,7 @@
import { URI, UriComponents } from 'vs/base/common/uri';
import { IEditor } from 'vs/editor/common/editorCommon';
import { ITextEditorOptions, IResourceEditorInput, TextEditorSelectionRevealType } from 'vs/platform/editor/common/editor';
import { ITextEditorOptions, IResourceEditorInput, TextEditorSelectionRevealType, IEditorOptions } from 'vs/platform/editor/common/editor';
import { IEditorInput, IEditorPane, Extensions as EditorExtensions, EditorInput, IEditorCloseEvent, IEditorInputFactoryRegistry, toResource, IEditorIdentifier, GroupIdentifier, EditorsOrder } from 'vs/workbench/common/editor';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IHistoryService } from 'vs/workbench/services/history/common/history';
......@@ -638,23 +638,23 @@ export class HistoryService extends Disposable implements IHistoryService {
if (lastClosedFile) {
(async () => {
const editor = await this.editorService.openEditor({
resource: lastClosedFile.resource,
options: {
pinned: true,
sticky: lastClosedFile.sticky,
index: lastClosedFile.index
}
});
// Make the editor sticky after opening it. Even though we provide
// the sticky option, the editor service may decide to not respect
// the flag given there is also an index provided which maybe outside
// of the sticky range
let options: IEditorOptions;
if (lastClosedFile.sticky) {
editor?.group?.stickEditor(editor.input);
// Sticky: in case the target index is outside of the range of
// sticky editors, we make sure to not provide the index as
// option. Otherwise the index will cause the sticky flag to
// be ignored.
if (!this.editorGroupService.activeGroup.isSticky(lastClosedFile.index)) {
options = { pinned: true, sticky: true };
} else {
options = { pinned: true, sticky: true, index: lastClosedFile.index };
}
} else {
options = { pinned: true, index: lastClosedFile.index };
}
const editor = await this.editorService.openEditor({ resource: lastClosedFile.resource, options });
// Fix for https://github.com/Microsoft/vscode/issues/67882
// If opening of the editor fails, make sure to try the next one
// but make sure to remove this one from the list to prevent
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册