Author |
Topic |
|
Pastafarian
New Member
3 Posts |
Posted - May 24 2016 : 05:47:38 AM
|
Hi,
I'd really appreciate to have something that helps navigating huge switch blocks. Would it be possible to add switch statements and a clickable listing of their "case" tags to VA Outline window? Or is there already something similar that I haven't noticed yet?
My vision is something like:
VA Outline
|
|_ someFunc()
|
|_ switch(someVar)
|
|_ case 1
|_ case 2
|_ ...
|_ default
Best regards, Alex |
Edited by - Pastafarian on May 24 2016 05:51:46 AM |
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - May 24 2016 : 10:24:57 AM
|
Can you give me a sense of how big, how long your case statements are? You can use the next and previous scope movement commands to help you move inside and between functions, but these look for matched pairs of curly braces. So that will only help if your cases have curly brackets inside them.
https://wholetomato.fogbugz.com/default.asp?W198 |
zen is the art of being at one with the two'ness |
|
|
Pastafarian
New Member
3 Posts |
Posted - May 24 2016 : 11:49:12 AM
|
Hi feline,
thanks for your reply.
Maybe I should first state that I'm mainly developing in C++, just in case that VA behaves a bit different in other languages. My primary IDE is VS2010 and I'm using VA 10.9.2076.0.
I'm often dealing with switch blocks having 30 or more case tags, each of which has 20 to 50 lines (including comments). They belong to state machines and I have to navigate through the whole structure to follow execution paths.
The scope navigation does not help, even if I surround the case body with curly braces. With my VA version it's simply not diving into functions. And anyway it's not really an adequate solution, even if it would.
A few minutes ago I found that VS has an option to parse and outline statement blocks. It's disabled by default. By enabling it, I can at least collapse and expand the case blocks, which is helpful.
Best regards, Alex |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - May 24 2016 : 2:56:37 PM
|
We have considered the idea of allowing VA Outline to give you an overview of the structure within the current function:
case=57709
but this is just a vague idea at the moment. Sadly no, we don't currently have anything in VA that is going to help you with this as it stands. If you are not using to many local variables, you could consider using Extract Method to pull out individual blocks as separate functions. I do this myself when I find I have to work with long switch statements.
Then using Find References or Alt-G makes it a lot easier to jump around and follow the code. The obvious problem here is that it requires modifying your code.
An alternative, building on the IDE option to allow you to expand and collapse blocks, you could try an IDE macro to jump to each case block in the current file and then collapse it, so the entire switch statement was collapsed, making it much easier to get an overview of what is happening. |
zen is the art of being at one with the two'ness |
|
|
Pastafarian
New Member
3 Posts |
Posted - May 24 2016 : 3:10:28 PM
|
That's great, feline, thanks for considering and for your suggestions.
Best wishes, Alex |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - May 26 2016 : 10:45:14 PM
|
For now, if you are interested in using an IDE macro to collapse the blocks, this macro might give you a few ideas and help get you going:
https://wholetomato.fogbugz.com/default.asp?W444 |
zen is the art of being at one with the two'ness |
|
|
|
Topic |
|