Intention Actions and Cursor Location?

Hello All,

Is there any way to 1) invoke the Intention Action (Alt+Enter) when not on the specific symbol, but just on the same line? and 2) after invoking something like "Create Field.." and completing the declaration, be returned back to the point where it was invoked?

I've been happily using IDEA for a year now (Eclipse convert) and this one issue annoys me.  When invoking the intention action of "Create Field..." I have to be on the symbol itself _and_ once I'm "done" I'm left at the declaration and have to find my way back to where I invoked it from.

If I type something like:

MyClass(String myVal) {
     this.myVal = myVal;[Cursor Here]

IDEA detects that I haven't declared a field called "myVal" and underlines it.  But to invoke the intention action I need to back up to "this.myVal" to get the option to declare it.  Once I choose "Create Field..." IDEA takes me to the top of my class, and helps me complete the delcaration like this:

private String myVal;[Cursor Here]

Once I'm done, I'm stuck here with no easy way to get back - AFAIK

Is there a way to streamline this?

FWIW - I believe both of these items work in Eclipse (Quick Fix anywhere on the line and "tabbing" back to the invocation point) so it may be a case of just not knowing the "IDEA way".

Thanks in advance!

- John

1 comment
Comment actions Permalink

Hello.

You can try F2 / Shift+F2 to go to next / previous closest error in the file. Then invoke an intention action and apply quick fix. Then Ctrl+Alt+Left to go to back by editing / navigation history. (All shortcuts are from default Windows keymap, they may be different e.g. on Mac. See main menu / Go to.)

Alexander.

0

Please sign in to leave a comment.