Update tree view sameple to include markdown tooltip

Part of https://github.com/microsoft/vscode/issues/120988
This commit is contained in:
Alex Ross
2021-04-14 13:39:51 +02:00
parent 68518aea0d
commit b338bca265

View File

@ -72,9 +72,11 @@ function getChildren(key: string): string[] {
function getTreeItem(key: string): vscode.TreeItem {
const treeElement = getTreeElement(key);
// An example of how to use codicons in a MarkdownString in a tree item tooltip.
const tooltip = new vscode.MarkdownString(`$(zap) Tooltip for ${key}`, true);
return {
label: /**vscode.TreeItemLabel**/<any>{ label: key, highlights: key.length > 1 ? [[key.length - 2, key.length - 1]] : void 0},
tooltip: `Tooltip for ${key}`,
label: /**vscode.TreeItemLabel**/<any>{ label: key, highlights: key.length > 1 ? [[key.length - 2, key.length - 1]] : void 0 },
tooltip,
collapsibleState: treeElement && Object.keys(treeElement).length ? vscode.TreeItemCollapsibleState.Collapsed : vscode.TreeItemCollapsibleState.None
};
}