mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
fix the logic to check the same level folders (#15143)
This commit is contained in:
@@ -451,9 +451,18 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
|
|||||||
let parentBookPath: string = notebookFolders.slice(0, notebookFolders.length - depthOfNotebookInBook).join('/');
|
let parentBookPath: string = notebookFolders.slice(0, notebookFolders.length - depthOfNotebookInBook).join('/');
|
||||||
let bookItemToExpand = parentBook.bookItems.find(b => b.tooltip.indexOf(parentBookPath) > -1) ??
|
let bookItemToExpand = parentBook.bookItems.find(b => b.tooltip.indexOf(parentBookPath) > -1) ??
|
||||||
parentBook.bookItems.find(b => path.relative(notebookPath, b.tooltip)?.split(path.sep)?.length === depthOfNotebookInBook);
|
parentBook.bookItems.find(b => path.relative(notebookPath, b.tooltip)?.split(path.sep)?.length === depthOfNotebookInBook);
|
||||||
|
|
||||||
|
if (!bookItemToExpand) {
|
||||||
|
// if the book isn't found, check if the book is in the same level as the parent
|
||||||
|
// since bookItems will not have them yet, check the sections->file property
|
||||||
|
bookItemToExpand = parentBook.bookItems.find(b => b.sections?.find(n => notebookFolders[notebookFolders.length - depthOfNotebookInBook - 1].indexOf(n.file.substring(n.file.lastIndexOf('/') + 1)) > -1));
|
||||||
|
// book isn't found even in the same level, break out and return.
|
||||||
if (!bookItemToExpand) {
|
if (!bookItemToExpand) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// increment to reset the depth since parent is in the same level
|
||||||
|
depthOfNotebookInBook++;
|
||||||
|
}
|
||||||
if (!bookItemToExpand.children) {
|
if (!bookItemToExpand.children) {
|
||||||
// We haven't loaded children of this node yet so do that now so we can
|
// We haven't loaded children of this node yet so do that now so we can
|
||||||
// continue expanding and search its children
|
// continue expanding and search its children
|
||||||
|
|||||||
Reference in New Issue
Block a user