Select notebook in viewlet when opened in editor (#14854)

* test changes

* code clean up

* remove extra line

* remove commented code

* remove unnecessary import

* update expand logic

* implement parent,children on bookitem

* merge conflicts

* refactor code

* fix trustBook test

* typo on condition

* feedback

* indexOf to include

* fix undefined error on expand

* remove set parent

* revert getTreeItem logic

* Fix duplicated nodes

* remove debug

* Clean up logic

* Fix tests

* Fix logic

* cleanup

* Cleanup findAndExpandParentNode (#14960)

Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
Maddy
2021-04-02 19:33:41 -07:00
committed by GitHub
parent 684dfc9760
commit 13ad4c9497
5 changed files with 150 additions and 67 deletions

View File

@@ -34,10 +34,12 @@ export interface BookTreeItemFormat {
treeItemCollapsibleState: number;
isUntitled: boolean;
version?: BookVersion;
parent?: BookTreeItem;
children?: BookTreeItem[];
}
export class BookTreeItem extends vscode.TreeItem {
private _sections: JupyterBookSection[];
private _sections: JupyterBookSection[] | undefined;
private _uri: string | undefined;
private _previousUri: string;
private _nextUri: string;
@@ -204,6 +206,22 @@ export class BookTreeItem extends vscode.TreeItem {
this._tableOfContentsPath = tocPath;
}
public get children(): BookTreeItem[] | undefined {
return this.book.children;
}
public set children(children: BookTreeItem[] | undefined) {
this.book.children = children;
}
public get parent(): BookTreeItem {
return this.book.parent;
}
public set parent(parent: BookTreeItem) {
this.book.parent = parent;
}
/**
* Helper method to find a child section with a specified URL
* @param url The url of the section we're searching for