Skip to content

Commit 74a31ef

Browse files
committed
properly reload via fsPath. TODO: could use workspace.notebookDocuments instead.
1 parent 6b46945 commit 74a31ef

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/client/repl/nativeRepl.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,21 @@ export class NativeRepl implements Disposable {
160160
let mementoUri = mementoValue ? Uri.parse(mementoValue) : undefined;
161161

162162
// const mementoFsPath = mementoUri?.fsPath;
163-
// const openEditorsFsPath = workspace.textDocuments.map((doc) => doc.uri.fsPath);
163+
164164
const openEditors = workspace.textDocuments.map((doc) => doc.uri);
165+
const openEditorsFsPath = workspace.textDocuments.map((doc) => doc.uri.fsPath);
165166
// TODO need to check if that memento URI exist in my tab
166167
// plain untitled notebook same uri as REPL.
167168
// editor option check
168-
if (mementoUri && openEditors.includes(mementoUri)) {
169-
this.replUri = mementoUri;
169+
if (mementoUri?.fsPath) {
170+
const matchingEditor = openEditors.find((uri) => uri.fsPath === mementoUri?.fsPath);
171+
if (matchingEditor) {
172+
this.replUri = matchingEditor;
173+
this.notebookDocument = workspace.notebookDocuments.find(
174+
(doc) => doc.uri.fsPath === matchingEditor.fsPath,
175+
);
176+
await this.context.globalState.update(NATIVE_REPL_URI_MEMENTO, this.replUri.toString());
177+
}
170178
} else {
171179
this.replUri = undefined;
172180
await this.context.globalState.update(NATIVE_REPL_URI_MEMENTO, undefined);

0 commit comments

Comments
 (0)