Skip to content

Commit 3a0c4fd

Browse files
committed
tab groups are returning same untitled-1-ipynb for notebook and REPL
1 parent 4a278e7 commit 3a0c4fd

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/client/repl/nativeRepl.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ import {
66
NotebookControllerAffinity,
77
NotebookDocument,
88
QuickPickItem,
9+
TabInputText,
910
TextEditor,
1011
Uri,
1112
workspace,
1213
WorkspaceFolder,
14+
window,
15+
TabInputTextDiff,
16+
TabInputNotebook,
1317
} from 'vscode';
1418
import { Disposable } from 'vscode-jsonrpc';
19+
import * as path from 'path';
1520
import { PVSC_EXTENSION_ID } from '../common/constants';
1621
import { showQuickPick } from '../common/vscodeApis/windowApis';
1722
import { getWorkspaceFolders } from '../common/vscodeApis/workspaceApis';
@@ -168,6 +173,9 @@ export class NativeRepl implements Disposable {
168173
(doc) => doc.uri.fsPath === replTabBeforeReload.fsPath,
169174
);
170175
await this.context.globalState.update(NATIVE_REPL_URI_MEMENTO, this.replUri.toString());
176+
const myFileName = path.basename(this.replUri.fsPath);
177+
const whatever = 'hi';
178+
const tabNames = getOpenTabNames();
171179
}
172180
} else {
173181
this.replUri = undefined;
@@ -191,6 +199,28 @@ export class NativeRepl implements Disposable {
191199
}
192200
}
193201

202+
function getOpenTabNames(): string[] {
203+
const tabNames: string[] = [];
204+
const tabGroups = window.tabGroups.all;
205+
206+
for (const tabGroup of tabGroups) {
207+
for (const tab of tabGroup.tabs) {
208+
if (tab.input instanceof TabInputText) {
209+
tabNames.push(tab.input.uri.fsPath);
210+
} else if (tab.input instanceof TabInputTextDiff) {
211+
if (tab.input.modified instanceof Uri) {
212+
tabNames.push(tab.input.modified.fsPath);
213+
}
214+
} else if (tab.input instanceof TabInputNotebook) {
215+
tabNames.push(tab.input.uri.fsPath);
216+
}
217+
}
218+
}
219+
const tabGroupTemp = tabGroups;
220+
221+
return tabNames;
222+
}
223+
194224
/**
195225
* Get Singleton Native REPL Instance
196226
* @param interpreter

0 commit comments

Comments
 (0)