Special color for TODO comments

General Discussion on RSyntaxTextArea.

Moderator: robert

Special color for TODO comments

Postby mgarin » Wed Aug 21, 2013 11:49 am

TODOs highlighting might be a good addition.
Ofcourse if it is possible to add without some hard manipulations or code syntax parsing...

Here is an example of TODOs in Java code (in RSyntaxTextArea):
Image

And here is how IntelliJ IDEA highlights it:
Image

Basically - it highlights anything that goes after "todo" mark (ignoring case) inside any comment with blue color.
Color can be moved to RSyntaxTextArea style settings i guess.
User avatar
mgarin
 
Posts: 3
Joined: Wed Aug 21, 2013 11:43 am

Re: Special color for TODO comments

Postby robert » Wed Sep 18, 2013 12:05 pm

Please add a feature request on GitHub so this request can be tracked.
User avatar
robert
 
Posts: 796
Joined: Sat May 10, 2008 5:16 pm


Re: Special color for TODO comments

Postby as3boyan » Fri Sep 20, 2013 5:31 pm

Have you saw this:
Image

FlashDevelop shows lines that has //TODO or //FIXME or //BUG under Tasks tab
But it doesn't set special color for those comments, I think that is much better solution, and don't require RSyntaxTextArea code changes.
as3boyan
 
Posts: 19
Joined: Mon Sep 16, 2013 8:21 pm

Re: Special color for TODO comments

Postby mgarin » Fri Sep 20, 2013 6:04 pm

I did not work with FlashDevelop, but yes, i know that there are a lot of editors which have different behavior and code highlighting.
Also i know that 3 most popular IDE for Java - IntelliJ Idea, Eclipse and NetBeans - do have TODOs highlight.
Actually a lot of code editors (and even some text editors) highlight some key phrases like "TODO", "FIXME" and others - TODO is simply the most popular one.

Also IDEs i mentioned before have a similar frame to the one you shown on the screenshot - with TODOs in your class/project, but that is totally different feature.
It is much better to see the TODOs highlights right in the code so you can easily spot them near some method/variable or whatever else while scrolling/reading through.
The frame with class/project TODOs might be used for other purposes but it is not a replacement for highlight at all.

Also, if such feature will actually be added into RSyntaxTextArea - you can just switch it off or simply set the color to the same color comments use, if you don't like that highlight so much of course.
So i don't really see why separate frame "is a much better solution" and why TODOs should not be added as a highlight option :)
User avatar
mgarin
 
Posts: 3
Joined: Wed Aug 21, 2013 11:43 am

Re: Special color for TODO comments

Postby robert » Sat Sep 21, 2013 5:00 pm

Actually, the "show TODO items in a table" thing is already doable (as long as you write the table component :D). This is done in RText, for example. This won't color them uniquely in the editor of course, as this would have to be built into the lexer.

RSTA comes with a TaskTagParser class, which can be installed like any other RSTA Parser, and locates TODO items. Unlike most Parsers, it doesn't squiggle underline the stuff it finds, but it does return them. The idea is that they can then be displayed in an ErrorStrip (which is done automagically), and if you want to display them elsewhere in the UI, like FlashDevelop does, you can do this yourself (which is what RText does).

java code:

TaskTagParser parser = new TaskTagParser();
parser.setTaskPattern("TODO|FIXME|HACK|REMIND|XXX"); // A regex of "todo" identifiers in comments
textArea.addParser(parser);
User avatar
robert
 
Posts: 796
Joined: Sat May 10, 2008 5:16 pm


Return to Open Discussion

Who is online

Users browsing this forum: No registered users and 5 guests

cron