Merge pull request #2423 from github/robertbrignull/query-tree-types

Simplify types around query panel
This commit is contained in:
Robert
2023-05-17 10:39:43 +01:00
committed by GitHub
2 changed files with 5 additions and 9 deletions

View File

@@ -32,9 +32,7 @@ export class QueryTreeDataProvider
* @param item The item to represent.
* @returns The UI presentation of the item.
*/
public getTreeItem(
item: QueryTreeViewItem,
): vscode.TreeItem | Thenable<vscode.TreeItem> {
public getTreeItem(item: QueryTreeViewItem): vscode.TreeItem {
return item;
}
@@ -43,9 +41,7 @@ export class QueryTreeDataProvider
* @param item The item to expand.
* @returns The children of the item.
*/
public getChildren(
item?: QueryTreeViewItem,
): vscode.ProviderResult<QueryTreeViewItem[]> {
public getChildren(item?: QueryTreeViewItem): QueryTreeViewItem[] {
if (!item) {
// We're at the root.
return this.queryTreeItems;

View File

@@ -1,13 +1,13 @@
import * as vscode from "vscode";
export class QueryTreeViewItem extends vscode.TreeItem {
public collapsibleState: vscode.TreeItemCollapsibleState;
constructor(
public readonly label: string,
public readonly tooltip: string | undefined,
label: string,
tooltip: string | undefined,
public readonly children: QueryTreeViewItem[],
) {
super(label);
this.tooltip = tooltip;
this.collapsibleState = this.children.length
? vscode.TreeItemCollapsibleState.Collapsed
: vscode.TreeItemCollapsibleState.None;