Use name from file tree instead of calculating from path

This commit is contained in:
Robert
2023-05-19 16:40:29 +01:00
parent a8f8990793
commit 4e46d87a77
2 changed files with 7 additions and 3 deletions

View File

@@ -39,6 +39,7 @@ export class QueryTreeDataProvider
fileTreeDirectory: FileTreeNode, fileTreeDirectory: FileTreeNode,
): QueryTreeViewItem { ): QueryTreeViewItem {
return new QueryTreeViewItem( return new QueryTreeViewItem(
fileTreeDirectory.name,
fileTreeDirectory.path, fileTreeDirectory.path,
fileTreeDirectory.children.map(this.convertFileTreeNode.bind(this)), fileTreeDirectory.children.map(this.convertFileTreeNode.bind(this)),
); );

View File

@@ -1,9 +1,12 @@
import * as vscode from "vscode"; import * as vscode from "vscode";
import { basename } from "path";
export class QueryTreeViewItem extends vscode.TreeItem { export class QueryTreeViewItem extends vscode.TreeItem {
constructor(path: string, public readonly children: QueryTreeViewItem[]) { constructor(
super(basename(path)); name: string,
path: string,
public readonly children: QueryTreeViewItem[],
) {
super(name);
this.tooltip = path; this.tooltip = path;
this.collapsibleState = this.children.length this.collapsibleState = this.children.length
? vscode.TreeItemCollapsibleState.Collapsed ? vscode.TreeItemCollapsibleState.Collapsed