SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => SlickEdit User Macros => Topic started by: Dennis on May 16, 2016, 09:09:16 PM

Title: v21 feature preview: edit-associated-symbol (jump between func and prototype)
Post by: Dennis on May 16, 2016, 09:09:16 PM
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
Title: Re: v21 feature preview: edit-associated-symbol (jump between func and prototype)
Post by: Phil Barila on May 16, 2016, 11:55:39 PM
SE *used to* jump between declaration and definition on Ctrl+Dot.  Does it not anymore?
Title: Re: v21 feature preview: edit-associated-symbol (jump between func and prototype)
Post by: Dennis on May 17, 2016, 12:04:50 AM
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.
Title: Re: v21 feature preview: edit-associated-symbol (jump between func and prototype)
Post by: Phil Barila on May 17, 2016, 12:14:43 AM
Ah, got it.
Title: Re: v21 feature preview: edit-associated-symbol (jump between func and prototype)
Post by: hs2 on May 17, 2016, 07:00:57 AM
Cool feature ++Dennis 8)
HS2