Skip to content

Commit 639caaf

Browse files
committed
leverage notebookDocument parameter typing to be nb|Uri|undefined for openInteractive
1 parent 435c200 commit 639caaf

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/client/repl/nativeRepl.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ export class NativeRepl implements Disposable {
165165

166166
const notebookEditor = await openInteractiveREPL(
167167
this.replController,
168-
this.notebookDocument,
169-
wsMementoUri,
168+
this.notebookDocument ?? wsMementoUri,
170169
preserveFocus,
171170
);
172171
if (notebookEditor) {

src/client/repl/replCommandHandler.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ import { PVSC_EXTENSION_ID } from '../common/constants';
2020
*/
2121
export async function openInteractiveREPL(
2222
notebookController: NotebookController,
23-
notebookDocument: NotebookDocument | undefined,
24-
mementoValue: Uri | undefined,
23+
notebookDocument: NotebookDocument | Uri | undefined,
2524
preserveFocus: boolean = true,
2625
): Promise<NotebookEditor | undefined> {
2726
let viewColumn = ViewColumn.Beside;
28-
if (mementoValue) {
29-
if (!notebookDocument) {
30-
notebookDocument = await workspace.openNotebookDocument(mementoValue as Uri);
31-
}
27+
if (notebookDocument instanceof Uri) {
28+
// Case where NotebookDocument is undefined, but workspace mementoURI exists.
29+
notebookDocument = await workspace.openNotebookDocument(notebookDocument);
3230
} else if (notebookDocument) {
3331
// Case where NotebookDocument (REPL document already exists in the tab)
3432
const existingReplViewColumn = getExistingReplViewColumn(notebookDocument);

0 commit comments

Comments
 (0)