提交 cea1d2f9 编写于 作者: R rebornix

fix notebook integration test

上级 6d79f864
...@@ -46,7 +46,7 @@ suite('notebook workflow', () => { ...@@ -46,7 +46,7 @@ suite('notebook workflow', () => {
}); });
test('notebook cell actions', async function () { test('notebook cell actions', async function () {
const resource = vscode.Uri.parse(join(vscode.workspace.rootPath || '', './second.vsctestnb')); const resource = vscode.Uri.parse(join(vscode.workspace.rootPath || '', './first.vsctestnb'));
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest'); await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
await waitFor(500); await waitFor(500);
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
...@@ -513,10 +513,10 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor { ...@@ -513,10 +513,10 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
this.list!.layout(); this.list!.layout();
// restore list state at last, it must be after list layout // restore list state at last, it must be after list layout
this.restoreTextEditorViewState(viewState); this.restoreListViewState(viewState);
} }
private restoreTextEditorViewState(viewState: INotebookEditorViewState | undefined): void { private restoreListViewState(viewState: INotebookEditorViewState | undefined): void {
if (viewState?.scrollPosition !== undefined) { if (viewState?.scrollPosition !== undefined) {
this.list!.scrollTop = viewState!.scrollPosition.top; this.list!.scrollTop = viewState!.scrollPosition.top;
this.list!.scrollLeft = viewState!.scrollPosition.left; this.list!.scrollLeft = viewState!.scrollPosition.left;
...@@ -526,8 +526,12 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor { ...@@ -526,8 +526,12 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
} }
const focusIdx = typeof viewState?.focus === 'number' ? viewState.focus : 0; const focusIdx = typeof viewState?.focus === 'number' ? viewState.focus : 0;
this.list!.setFocus([focusIdx]); if (focusIdx < this.list!.length) {
this.list!.setSelection([focusIdx]); this.list!.setFocus([focusIdx]);
this.list!.setSelection([focusIdx]);
} else if (this.list!.length > 0) {
this.list!.setFocus([0]);
}
if (viewState?.editorFocused) { if (viewState?.editorFocused) {
this.list?.focusView(); this.list?.focusView();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册