Author Topic: v21 feature preview: edit-associated-symbol (jump between func and prototype)  (Read 6173 times)

Dennis

  • Senior Community Member
  • Posts: 3992
  • Hero Points: 520
The attached macro provides a convenient way to jump from the current function you are working on to it's prototype (and back).  This is similar to the idea behind edit-associated-file (to jump between .cpp and .h) files, except it would operate on the symbol level, hence the appropriate name would be edit-associated-symbol, and Alt+` would be an easy to remember binding since edit-associated-file is Ctrl+`.

Example:

// test.cpp
int foobar(int x, int y<cursor here>) {  // hit Alt+', switches to test.h
   x += 32;
   y =- 32;
   if (x==y) return 0;
   return x+y;
}

// test.h
extern int<cursor here> foobar(int x, int y);  // hit Alt+`, switches back to test.cpp
« Last Edit: May 16, 2016, 09:22:26 PM by Dennis »

Phil Barila

  • Senior Community Member
  • Posts: 745
  • Hero Points: 61
SE *used to* jump between declaration and definition on Ctrl+Dot.  Does it not anymore?

Dennis

  • Senior Community Member
  • Posts: 3992
  • Hero Points: 520
This is different.  You don't have to have your cursor on the function name to use this, just within the body of the function or prototype.  Saves you the time of moving to the cursor to the current function name and then hitting Ctrl+Dot.

Phil Barila

  • Senior Community Member
  • Posts: 745
  • Hero Points: 61
Ah, got it.

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Cool feature ++Dennis 8)
HS2