Fix Notebook Viewlet Highlighting (#10868) (#10870)

* Stop double tree data provider registrations

* revert book finding logic, leverage currentBook
This commit is contained in:
Chris LaFreniere
2020-06-10 22:56:57 -07:00
committed by GitHub
parent 7091480c55
commit 4095037f25
2 changed files with 2 additions and 6 deletions

View File

@@ -232,12 +232,10 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
if (!uri) {
let openDocument = azdata.nb.activeNotebookEditor;
if (openDocument) {
let book = this.books.find(b => openDocument.document.uri.fsPath.replace(/\\/g, '/').toLowerCase().indexOf(b.bookPath.toLowerCase()) > -1);
bookItem = book?.getNotebook(openDocument.document.uri.fsPath);
bookItem = this.currentBook?.getNotebook(openDocument.document.uri.fsPath);
}
} else if (uri.fsPath) {
let book = this.books.find(b => uri.fsPath.replace(/\\/g, '/').toLowerCase().indexOf(b.bookPath.toLowerCase()) > -1);
bookItem = book?.getNotebook(uri.fsPath);
bookItem = this.currentBook?.getNotebook(uri.fsPath);
}
if (bookItem) {
// Select + focus item in viewlet if books viewlet is already open, or if we pass in variable

View File

@@ -138,8 +138,6 @@ export async function activate(extensionContext: vscode.ExtensionContext): Promi
});
extensionContext.subscriptions.push(vscode.window.registerTreeDataProvider(BOOKS_VIEWID, bookTreeViewProvider));
extensionContext.subscriptions.push(vscode.window.registerTreeDataProvider(PROVIDED_BOOKS_VIEWID, providedBookTreeViewProvider));
return {
getJupyterController() {
return controller;