File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments