Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 different highlighting between comment types
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

hell_butcher
Starting Member

1 Posts

Posted - Jul 29 2007 :  11:19:51 AM  Show Profile  Reply with Quote
I got really addicted to VAX in the past months now, and I would really love to see a couple of new features.

One of them is the ability to differentiate between two kinds of comment styles and allow to highlight them differently, like in Kate or Eclipse for instance:


// this is a C++ style comment
/* this is a C style comment */
/** this is an informative java style comment, usually multiline */


This would *really* improve the readability of the source, especially to have an immediate differentiation between informative comments and some code that has been commented-out.

Cheers

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Jul 30 2007 :  07:05:23 AM  Show Profile  Reply with Quote
The first problem here is that we do not have the concept of an "informative" comment. People often have comments like this:

/***
 * comment here
 ***/


or:

//************************ this is important! ************************

which can quickly become:

/************************ this is important! *************************/

Once you throw multi-line Doxygen style comments, or some other type of structured comment into the mix the whole idea starts to fall apart.

Have you considered using autotext to insert a template for an obvious comment, something that adds a clear marker block you can quickly spot while scrolling through the code?

zen is the art of being at one with the two'ness
Go to Top of Page

cyril
Junior Member

19 Posts

Posted - Jul 30 2007 :  07:34:09 AM  Show Profile  Reply with Quote
Thank you for your answer.

I sometimes use autotext for my comments ( /** and /*- ).
I understand your point of view. Having a comment block clearly emphasise an informative comment.
Nevertheless, I would really love having several conceptual types of comments (at least two) that could be highlighted differently, especially to attenuate the visual "presence" of commented-out code that sometimes make my code really painful to read, since right all the comments are in flashy green :)

To me, there are mostly three kinds of comments: blocks (file headers, function headers...), informative in-code comments (in-line explanation for some code), and commented-out code, that one really wants to be less flashy.
Go to Top of Page

cyril
Junior Member

19 Posts

Posted - Jul 30 2007 :  07:35:12 AM  Show Profile  Reply with Quote
(sorry I had issues with my accounts on this forum, hell_butcher = cyril)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Jul 30 2007 :  07:48:33 AM  Show Profile  Reply with Quote
If commented out code is the main target here... which IDE are you using?

If you are using VC6 or VS2003 then try wrapping the commented out code in:

#if 0 //{{AFX_COMMENTED_OUT
#endif //}}AFX_COMMENTED_OUT

as explained here:

http://forum.wholetomato.com/forum/topic.asp?ARCHIVE=true&TOPIC_ID=2253&SearchTerms=

If you are using VS2005 then the IDE will colour code that is blocked out with #if 0, #endif directly, once it updates its self and works out the code is inactive. This requires that you have left the IDE's intellisense parser enabled.

In both cases you can configure the colour that is used in the IDE's font and colour options, you just have to find the correct item.

zen is the art of being at one with the two'ness
Go to Top of Page

cyril
Junior Member

19 Posts

Posted - Jul 30 2007 :  08:01:54 AM  Show Profile  Reply with Quote
I use VS2005. Your proposal is very interesting, since the effect it provides is exactly what I expect.
Unfortunately I find some drawbacks:
- it is *really* painful to add two preprocessor lines to comment out a line or two, especially when doing this often and/or at many places
- it lengthens the code (and thus alters its visual/mind print)
- the hack is different on VC6/VS2003 and VS2005 (a solution based on comment types would be "portable" even beyond MS IDEs)
- you cannot comment-out less than a full line of code

Again, thanks for your time
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Jul 30 2007 :  09:20:10 AM  Show Profile  Reply with Quote
The speed of doing this has an easy fix, select the code and then trigger "Insert Autotext" and select the #if 0, #endif item. You can easily customise this to suit your needs, but the basic autotext code you want is:

#if 0
$selected$
#endif

You can bind a keyboard shortcut to VAssistX.InsertAutotext if this helps, and the items are suggested in the order they are shown in the autotext dialog, so by simply dragging and dropping them in the tree view you can reorder the resulting menu of suggestions.

I agree, this is different between different IDE's, which is a bit frustrating, but in all IDE's this is actually using a built in feature of the IDE, which has changed between IDE's.

I don't know of any special markers that would do what you want and that work on all IDE's.

Portability beyond MS IDE's gets us into a whole different world, since my preferred non Microsoft code editor is VIM, and the rules are quite different there.

I would expect the level of indenting to help you, since any commented out code inside a function should be indented normally. Personally I have always used this method, even going as far as to remove all indenting on temporary debug code to make it easier to find in the middle of a function.

The other points, they are sensible, but the practical answer is that there is no standard, no definition for "special comments", since everyone works differently. For a partial answer on adding more syntax highlighting blocks see here:

http://docs.wholetomato.com?W146

zen is the art of being at one with the two'ness
Go to Top of Page

cyril
Junior Member

19 Posts

Posted - Jul 30 2007 :  09:40:49 AM  Show Profile  Reply with Quote
Thank you for your long answer.
The InsertAutoText trick is ok, I guess...
Anyhow, I really think that Doxygen style comments /** ... */ should be highlighted in a more flashy way that other comments /* ... */ and //...

Keep on making VAX as good as possible!
Cheers,
Cyril
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Jul 30 2007 :  10:56:25 AM  Show Profile  Reply with Quote
quote:
Originally posted by cyril

Anyhow, I really think that Doxygen style comments /** ... */ should be highlighted in a more flashy way that other comments


except that we have no sensible definition of doxygen comments, since what really matters are the tags, and there are a *lot* of tags, in different formats...

and then you get into XML format comments
and other types of structured comments.

Unfortunately this is one of those things that is not as simple as it at first sounds.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000