Author |
Topic |
|
tharkaway
Junior Member
USA
11 Posts |
Posted - Aug 03 2004 : 08:39:44 AM
|
Is there any way to find the matching symbol for various C symbols? I have been working with some old legacy C code. As I have been trying to unwind this code and clean it up, I found that many times it would have been useful to highlight a block of code, or just to find the end of a block of code. In the simplest case with the cursor on a '{', I would have liked to have VA highlight all the code up to the matching '}'. Other useful matchings would include if/elseif/else and #ifdef/#else/#endif constructs. |
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Aug 03 2004 : 6:10:27 PM
|
are you familiar with the IDE command ctrl_] ? sit on either { or }, and the caret will jump to the matching brace. this also works for () and #if 0, #else, #endif
also, try turning on VAX -> options -> text editor -> correction -> highlight matching {} and () this works fine for me in C. setting it to a really obvious colour should also help.
you could also try selecting the entire file and telling the IDE to format it, which may help by re-indenting the code into a more consistent and meaningful manor. |
zen is the art of being at one with the two'ness |
|
|
tharkaway
Junior Member
USA
11 Posts |
Posted - Aug 04 2004 : 09:39:05 AM
|
Thanks for the suggestions. I did have the VA option to highlight matching {}'s on, but if the {}'s were a long way apart it did not seem to work properly (e.g the matching brace would not highlight). I was doing most of my work in VA 6, but I just tried this again in VAX and it still doesn't not work. If I put the cursor on the opening { of a 1300 line procedure, and scroll down to the closing brace, it is not highlighted.
I didn't realize the IDE had these options. One of these days I need to take the time to go through every menu option to see what is available. In the above mentioned example Ctrl-] was able to jump to the closing {.
I also found that the Format command did not work perfectly in VS6.0. Coming out of a 200+ line switch statement, the closing { was not indented at all while the opening { was indented two tabs. This is another case where the the closing { was not highlighted when the opening [ was and again where Ctrl-] worked properly.
Thanks again for the help.
|
|
|
support
Whole Tomato Software
5566 Posts |
Posted - Aug 04 2004 : 3:08:17 PM
|
There is a limit to the distance between {}'s, both in VA 6.0 and VA X. Not sure what the limit is. We'll find out and add it to our documentation. |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Aug 04 2004 : 5:53:59 PM
|
quote: Originally posted by tharkaway
I also found that the Format command did not work perfectly in VS6.0. Coming out of a 200+ line switch statement
the formatting command in .NET 2003 doesn't always handle tiny switch statements correctly
you may want to check out GC, URL thanks to Uniwares, which is a free tool to format you C and C++ code.
it seems to take a bit of setting up, but it should produce far more reliable results than VS. |
zen is the art of being at one with the two'ness |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Aug 04 2004 : 5:59:15 PM
|
quote: Originally posted by tharkaway
I didn't realize the IDE had these options. One of these days I need to take the time to go through every menu option to see what is available.
you may find http://www.codeproject.com/tips/VSnetIDETipsAndTricks.asp to be useful |
zen is the art of being at one with the two'ness |
|
|
tharkaway
Junior Member
USA
11 Posts |
Posted - Aug 09 2004 : 11:23:17 AM
|
Thanks for the tips. GC worked like a charm. I liked the way they format muti-line conditions for IF statements. Too bad I've already done allmost all the work by hand. |
|
|
|
Topic |
|