mikaeljorhult / brackets-todo

Brackets/Edge Code extension that displays all TODO comments in current document or project.
144 stars 37 forks source link

Request to group items #30

Open fgiacomelli opened 10 years ago

fgiacomelli commented 10 years ago

Hello, I would like to group items for extra tag, i.e. when I add something to the change list it would be great if I could group by data, viewing the changes of yyyy/mm/dd all in one big row, because now I've to create a Change element adding the data in the row but it's not so easy as it would be

mikaeljorhult commented 10 years ago

Do I understand you correctly if you would like to add meta data to your comments and then be able to filter the list according to that data?

This might be outside of the scope of this extension but if you could make a quick mockup you might be able to convince me.

mikaeljorhult commented 10 years ago

Closing this for now until more feedback form user.

rhbecker commented 10 years ago

Your interpretation of this request is pretty close to what I was thinking of opening an issue about - i.e. the ability to add custom metadata that could then be used for filtering or sorting of the list.

My particular use case is for when team members might sign their comments at the end. Being able to filter on, or sort by the person who wrote the comment would be cool. Example of a "signed" comment:

# TODO: Add support for filtering on custom captures. ----- @rhbecker

One potential implementation option is to inspect prefix / suffix expressions for named capture groups. The capture's name could become a column header (in a sortable view), or a filter type (in a filterable view). The captured text, would then be the contents of the column or of the clickable filter tag.

So, a suffix expression to support my author use case might look like ...

):? *(?<content>.+) ?----- ?@?(?<author>.+))(?=\*/|\n|$)

A Stackoverflow answer tells me that JavaScript can support named captures via xregexp. I've not used that library, but 24 SO up votes seems promising. And I just noticed that it's authored by Steven Levithan, who also authored an O'Reilly book called Regular Expression Cookbook.

mikaeljorhult commented 10 years ago

Interesting idea @rhbecker. I've reopened this issue for now while I look into if/how this could be done.

anzhihun commented 10 years ago

nice idea! Our team also has the requirement.

anzhihun commented 10 years ago

The UI may look as follow: bracket-group How do you think about? @fgiacomelli @mikaeljorhult @rhbecker

mikaeljorhult commented 10 years ago

It might be nice to implement it a bit more generic to allow for more workflows. I was thinking about allow you to add tags to each comment (maybe through something like --tagname) and sort and filter through that.

anzhihun commented 10 years ago

You are right. It is not that all comment must contain all tags. Each comment may has it's own tag. Such as: // TODO: filter comment by custom tag --author:rhbecker // FUTURE: implement dark theme --worker:mikaeljorhult The first comment has the custom tag [author], and the second comment has another tag [worker].

All custom tags should show or hide on the table header according to the user. and enable to sort and filter.

Now there is a problem that how to define the custom tag? Use "--tagename:value" or "[tagname:value]" or others? Do you have some suggestions @mikaeljorhult ?

rhbecker commented 10 years ago

Were you to leverage named captures, you'd not need to dictate any particular tagging format. Each user can compose his/her own regex to match a unique format, with custom names for each captured pattern.

Example A

@rhbecker likes his signature at the end, and he likes to think of signers as authors:

# TODO: Provide example of sig at the end. ----- @rhbecker
):? *(?<content>.+) ?----- ?@(?<author>[^\s]+)(?=\*/|\n|$)

Example B

@mikaeljorhult likes his signature at the beginning, without the dashes, and he likes to think of signers as handlers:

# TODO: @mikaeljorhult Provide example of sig at the beginning.
):? *@(?<handler>[^\s]+)(?<content>.+)(?=\*/|\n|$)

In a sort-able UI, @rhbecker would see content and author as his column headers, while @mikaeljorhult would see handler and content. I think you could still support a filterable view as well, but you might need some extra logic. For instance, you might only allow filtering for named captures where the matches do not exceed n characters in length. You can probably think of something better.

anzhihun commented 10 years ago

Thank you @rhbecker ! Good idea! I have take a look at xregex and test it simply. It's powerful and can deal with this issue.