Gruntfuggly / todo-tree

Use ripgrep to find TODO tags and display the results in a tree view
Other
1.44k stars 139 forks source link

Feature request: Display amount per file/folder #698

Closed yifanwww closed 1 year ago

yifanwww commented 1 year ago

Hi, thanks for providing this great plugin, I really like it.

I did a simple search on previous issues about the ability to display the amount, and found that vscode doesn't seem to expose an API to do that.

However, instead of displaying it in activity bar, I think we still are able to display the amount in the side bar: image

I don't have any experience on developing a vscode plugin, but I guess in the sidebar, a plugin can completely control how to render that area.

Gruntfuggly commented 1 year ago

Sadly plugins have very little control over what can be rendered. Have a look here https://code.visualstudio.com/api/references/vscode-api#TreeItem for an idea what can be displayed - you'll see there isn't much.

Have you tried setting "todo-tree.tree.showCountsInTree": true, - it doesn't show them like the image above, but its about as close as I can get it.

yifanwww commented 1 year ago

Wait... I suddenly found out that todo-tree already supports activity-bar-badge, I just need to turn on "todo-tree.general.showActivityBarBadge". Great!!

I tried "todo-tree.tree.showCountsInTree": true just now, and yes it does display the counts per file/folder, thanks!


I saw some extensions who make very complicated UI in the sidebar, so I thought extension can fully control the UI (or control much of the UI). I don't know how they do that.

I checked your code and found out this extension uses TreeView/TreeItem to render the TODO items. As vscode doesn't expose many APIs under TreeItem, then yeah we cannot display the count in the badge...

I also checked vscode code to see how search displays the badge, there is a CountBadge component but vscode doesn't expose it either, which is sad.

Anyway, I can turn on "todo-tree.tree.showCountsInTree". Thanks for your reply! Thanks for your extension!