NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Code Navigator: Move through control-structures (switch, if)


Joined: 29 May 2007
Posts: 29
Reply with quote
Hi,

i've got often long switch-case constructs with a lot of cases an a lot of code inside it. It would be nice when the case-statements show up in the Code Navigator.

Maybe the Code Navigator could genererally show up (optionally!) control-structures like "if", "for", "switch" with their statements


for example:

Code:

class Render
  |-- public showContent($content)
     |-- switch (content)
        |-- case "test1"
        |-- case "test2"
     |-- if (output)


cheers,
Otto
View user's profileFind all posts by bruno701Send private message
Guru master

Joined: 05 Jul 2004
Posts: 659
Location: Belgium
Reply with quote
That's actually not a bad idea!
In an ideal world it would also be possible to define how long the actual construct/branch had to be before it showed up. I think having all blocks in there would be unmanageable, while the having the functionality would be cool Smile
View user's profileFind all posts by BlizzSend private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
I have some doubts. Cloaking Code Navigator with all language statements and operators would quickly make is huge and therefore useless.
You can use code folding and effectively collapse long code to see clean structure.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Guru master

Joined: 05 Jul 2004
Posts: 659
Location: Belgium
Reply with quote
Yes, but the IDE could for example have a switch that only adds a node for the specific control structure if it is longer than X lines or something.
View user's profileFind all posts by BlizzSend private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
With long "case" statement you'll turn "case" on, then for long "if", you will turn it on too and so forth. As a result, Navigator will be clattered with stuff.
On the other hand, what would you like to see in the Navigator for "case" or "if" operators? Just "if" and "case" words? Suppose there are 20 ifs and what? Is it useful?

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Guru master

Joined: 05 Jul 2004
Posts: 659
Location: Belgium
Reply with quote
If there's a comment the line above of after the statement it could take that as label...

Code:

switch
{
   case 'a' : // Case for A
      break;
 
    // Case for B
   case 'b' :
      break;
}


If no comment is specified, it could use a part of the condition or whatever there is between the brackets to clarify.
Anyway, its obviously your call, but I still think that for the longer structures it could be very handy Smile

What if the functionality was to only add the active control structure to the navigator ?
There could be 2 options then:
1)
Toggle it with a hotkey: Suppose your in a big switch statement, you press the hotkey and it adds the current structure to the navigator.
Only that, nothing further.
You would then effectively be able to only add those that you want to the navigator and turn them on/off. (the one I prefer)
2) Only the active one: You place the cursor in the switch, it shows you the labels and you can navigate to the. When the cursor leaves the switch it hides again and shows the new (if/any) structure.

Since you probably already split the sourcefiles in nodes to show in the navigator, it should be possible no?
Not saying it's not a lot of work but we can dream no?
View user's profileFind all posts by BlizzSend private messageVisit poster's website


Joined: 29 May 2007
Posts: 29
Reply with quote
dmitri wrote:
With long "case" statement you'll turn "case" on, then for long "if", you will turn it on too and so forth. As a result, Navigator will be clattered with stuff.
On the other hand, what would you like to see in the Navigator for "case" or "if" operators? Just "if" and "case" words? Suppose there are 20 ifs and what? Is it useful?


Hi,

i know it is difficult to find a intuitive way to handle this in the code-navigator. But the fact is: i spend much time for scrolling to jump to other parts of the same file.

maybe you can leave the code-navigator as it is, and invent an additional tab with something like this:

Code Overview/Code Zoomer




Smile
View user's profileFind all posts by bruno701Send private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
Smile that's interesting.
feel free start voting on the feature.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Guru master

Joined: 05 Jul 2004
Posts: 659
Location: Belgium
Reply with quote
It has my vote, it's a nice alternative to the original suggestion
View user's profileFind all posts by BlizzSend private messageVisit poster's website
Code Navigator: Move through control-structures (switch, if)
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic