mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Fix error when calling getParent (#11252)
This commit is contained in:
@@ -29,7 +29,7 @@ export interface BookTreeItemFormat {
|
||||
|
||||
export class BookTreeItem extends vscode.TreeItem {
|
||||
private _sections: IJupyterBookSection[];
|
||||
private _uri: string;
|
||||
private _uri: string | undefined;
|
||||
private _previousUri: string;
|
||||
private _nextUri: string;
|
||||
public command: vscode.Command;
|
||||
@@ -124,7 +124,7 @@ export class BookTreeItem extends vscode.TreeItem {
|
||||
return this.book.title;
|
||||
}
|
||||
|
||||
public get uri(): string {
|
||||
public get uri(): string | undefined {
|
||||
return this._uri;
|
||||
}
|
||||
|
||||
|
||||
@@ -485,7 +485,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
|
||||
}
|
||||
|
||||
getParent(element?: BookTreeItem): vscode.ProviderResult<BookTreeItem> {
|
||||
if (element) {
|
||||
if (element?.uri) {
|
||||
let parentPath: string;
|
||||
parentPath = path.join(element.root, Content, element.uri.substring(0, element.uri.lastIndexOf(path.posix.sep)));
|
||||
if (parentPath === element.root) {
|
||||
|
||||
Reference in New Issue
Block a user