Skip to content

Commit

Permalink
fix: invalid tree item (issue #389) which occurs for some datapacks i…
Browse files Browse the repository at this point in the history
…n the datapack explorer in-combination with the latest release of vscode
  • Loading branch information
Codeneos committed Oct 19, 2022
1 parent 32fb439 commit 51c673f
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,16 @@ export default class DatapackDataProvider extends BaseDataProvider<DatapackNode>
}

public toTreeItem(node: DatapackNode & TreeNode): vscode.TreeItem {
const description = node.getItemDescription?.();
const tooltip = node.getItemTooltip?.();
const label = node.getItemLabel?.();

return {
id: node.getId(),
label: node.getItemLabel(),
tooltip: node.getItemTooltip?.(),
label: typeof label === 'string' ? label : '<LABEL MISSING>',
tooltip: typeof description === 'string' ? tooltip : undefined,
iconPath: this.getItemIconPath(node.icon),
description: node.getItemDescription?.(),
description: typeof description === 'string' ? description : undefined,
contextValue: `vlocode:datapack:${node.nodeType}`,
collapsibleState: typeof node.collapsibleState === 'boolean'
? (node.collapsibleState ? TreeItemCollapsibleState.Collapsed : TreeItemCollapsibleState.None)
Expand Down

0 comments on commit 51c673f

Please sign in to comment.