Skip to content

Commit

Permalink
leverage notebookDocument parameter typing to be nb|Uri|undefined for…
Browse files Browse the repository at this point in the history
… openInteractive
  • Loading branch information
anthonykim1 committed Nov 19, 2024
1 parent 435c200 commit 639caaf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/client/repl/nativeRepl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,7 @@ export class NativeRepl implements Disposable {

const notebookEditor = await openInteractiveREPL(
this.replController,
this.notebookDocument,
wsMementoUri,
this.notebookDocument ?? wsMementoUri,
preserveFocus,
);
if (notebookEditor) {
Expand Down
10 changes: 4 additions & 6 deletions src/client/repl/replCommandHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ import { PVSC_EXTENSION_ID } from '../common/constants';
*/
export async function openInteractiveREPL(
notebookController: NotebookController,
notebookDocument: NotebookDocument | undefined,
mementoValue: Uri | undefined,
notebookDocument: NotebookDocument | Uri | undefined,
preserveFocus: boolean = true,
): Promise<NotebookEditor | undefined> {
let viewColumn = ViewColumn.Beside;
if (mementoValue) {
if (!notebookDocument) {
notebookDocument = await workspace.openNotebookDocument(mementoValue as Uri);
}
if (notebookDocument instanceof Uri) {
// Case where NotebookDocument is undefined, but workspace mementoURI exists.
notebookDocument = await workspace.openNotebookDocument(notebookDocument);
} else if (notebookDocument) {
// Case where NotebookDocument (REPL document already exists in the tab)
const existingReplViewColumn = getExistingReplViewColumn(notebookDocument);
Expand Down

0 comments on commit 639caaf

Please sign in to comment.