Gruntfuggly / todo-tree

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

Group by tag and by subtag? #579

Open mhkeller opened 2 years ago

mhkeller commented 2 years ago

I'm not getting the results I expected and wanted to see if this behavior is supported and I'm doing something incorrectly or it's just simply not supported.

I have to main tags I use, TODO for general TODOs and then @subtag which I use to tag concepts. In this case the @ is the tag and the text following it is the subtag.

Here's an example markdown file

TODO find more examples

@kitchen
Normal text typing here related, to say, things in the kitchen.

@living-room
Normal text typing here related to the living room

In the sidebar, I currently have things grouped by Tag so I can easily separate my TODOs from my subtagged things. I'm using this as my subtag regex @*(.*).

I'm using the Flat view. When I group by subtag, I expected my TODO list to remain unchanged because there are no subtags, and then I expected the @ tag items to be grouped by each subtag (kitchen, living-room). If I group just by tag, I get simple, easy to understand tag groupings but they aren't grouped by subtag. If I group by both tag and subtag, the layout of the flat view doesn't change. If I only group by subtag, I get clean, good groupings of my subtags for things with the @ tag but my TODO tags are all a mess – I want those to not have any concept of subtags.

Am I doing something wrong in my configuration or is this pushing the boundaries too much of what can be done?

tldr; I want folders grouped by subtag but only on certain tags

Gruntfuggly commented 2 years ago

I'm not completely clear what you are trying to achieve - can you create a mock up (just text will do) showing what you expect to see in the tree (maybe for your example above)?

mhkeller commented 2 years ago

Thanks for the help.

Here's a sample document. I made a folder and named this file readme.md and then duplicated it as a file named readme-copy-md:

TODO a thing

@living-room needs painting

@kitchen needs painting

@kitchen another thing

I'm using this as the subtag regex @*((\w|-)+)

"Group by subtag" option in the "Flat" view gives me this:

Screen Shot 2021-11-08 at 11 42 14 AM

That's great because it's surfacing that I have a subtag called kitchen that exists in multiple documents and I can see those instances.

My two TODO tags are ungrouped, though – which makes sense since I'm not doing any grouping by tag.

If I now select "Group by tag" I get this:

Screen Shot 2021-11-08 at 11 44 31 AM

My TODO tags are now grouped but my subtags are ungrouped. I see duplicate entries for kitchen and living-room.

Is there any way to keep the subtag folders I see in the first example while still grouping all of my TODOs under one entry? I tried fiddling with the regex a bit and changing it to @\w((\w|-)+) but that doesn't seem to capture any subgroups.

mhkeller commented 2 years ago

Just checking if you've had a moment to see if I'm doing anything obviously wrong here. Thanks for your help and for such a useful plugin.

Gruntfuggly commented 2 years ago

Sorry - been a bit preoccupied this week, but I'll try and have a look over this weekend.

CopyBook-Maxim commented 2 years ago

Good afternoon. Were you able to see. Also interested in this question

mhkeller commented 1 year ago

Hi, Just wanted to check back in on this one.