Fix Notebook Viewlet Highlighting (#10868)

* Stop double tree data provider registrations

* revert book finding logic, leverage currentBook
This commit is contained in:
Chris LaFreniere
2020-06-10 22:27:16 -07:00
committed by GitHub
parent 3f21caddb6
commit 168ef80d8f
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