User forums > General (but related to Code::Blocks)

Editor idea: F11 swap directly between method definition (.h) and body (.cpp)

(1/2) > >>

MB:
Just an idea for the editor that would be very useful:

If the cursor is inside a method body (.cpp file):

void X:foo()
{
  ... <=
}

then pressing F11 jumps to the .h file and (new feature) places the cursor on the method definition line:

class X
{
  void x();
  void foo(); <=
  void z();
};

And pressing F11 in the .h file (with the cursor on a method definition line) => jumps to the .cpp file with (new feature) the cursor inside the body of the method.

This makes navigating back and forth between method definition and method body very fast.

kidmosey:
First of all, why do you need to go to the method declaration?  All that will do is tell you what you already know.  Personally, I keep the header scrolled to the internal variables.  If the IDE was constantly changing my cursor location, I would quickly get frustrated.

Doing something like this limits the usage of F11.  Generally, it is not too difficult to scroll a header file to the correct method declaration, and in most cases you are interested in looking at various other methods instead of the one you are currently in.

And then would you make it visa versa, as well?  That way would be even more frustrating, you move the cursor in the header file and you are suddenly somewhere else in your code, miles away from what you were working on.

Maybe if document switching gets changed so it goes to the previous document instead of round-robin, it might work (in which case I wouldn't use f11 anymore), but even then it should only be an option in the preferences.

fili:
I think that this kind of jumping would be useful. Some IDE's have ctrl+click (or ctrl+b) on the function/variable to jump to it's declaration. Or, even more useful, jump from function use to function declaration or implementation. Anything that eases navigation is good. My favourite Java IDE (IntelliJ Idea) has multiple jumping possibilities. So, why not C::B?

LE: you need to go to a function declaration for modifying it's parameters, for example. Let's say I have the foo(int) function. I want to create the foo(int,int) function and declare it next to the foo(int). Or something else...

Ceniza:
You could use right click on the method/function name -> "Find declaration/implementation of" to jump from one place to another and even use Shift+F12 (Toggle all folds) in source files to get, basically, the name of all methods.

I'm also wondering why you would like something like that. I find it useful only to compare function/method signatures, but that's something you'ren't constantly doing.

kidmosey: nice and disturbing avatar you got there :P

kidmosey:

--- Quote from: Ceniza on July 12, 2006, 07:40:56 am ---kidmosey: nice and disturbing avatar you got there :P

--- End quote ---

haha, yeah... my wife, the photographer.

Navigation

[0] Message Index

[#] Next page

Go to full version