Shift F6 unpredictable behaviour?
If I press shift+F6 on a local variable, sometimes I can type directly in the code and see all other instances of the variable change their name in real time as I type
In some other cases, when doing the same, I get instead a grey dialog box in which I have to type the new name and then press Refactor.
For example in this code:
void dummyfunc() {
double aaaa = 45;
double bbbb = 45;
double cccc = bbbb;
for ( int y = 0; y < 502 ; y++ ) {
double dddd = 456.0;
double eeee = 1.0;
double height =150 - dddd;
double n = Math.sqrt(eeee * eeee + height * height );
double ffff = eeee / n;
double angle = Math.acos(ffff);
if(angle > cccc ) cccc = angle;
System.out.println("" + height );
}
}
Temporarily put that function in any class. If I put the cursor on "height" and press Shift+F6, a grey dialog pops up. If I put the cursor on "eeee" and press Shift+F6, it allows the realtime-typing.
Does that happen to you to or is this only in my intellij and maybe depending on the project?
What causes the variable height to behave different?
I love the realtime typing thing. But if the grey dialog pops up instead, then I prefer doing it manually, because even though it's a local variable, I've had experiences with this grey dialog such as a name of something *everywhere* in the whole project being changed so I don't trust that grey dialog!!
Please sign in to leave a comment.
Hello Aardwolf,
dialog is shown for fields, methods etc. For local variables there is a setting
to enable inplace rename in File|Settings|Editor.
Your code snippet works fine here. Seems that you try to rename a field somehow.
Thank you
-
Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
Note that if the name of the local variable occurs in a string or comment somewhere, the rename dialog will pop up. This allows you to optionally locate and rename references to the variable in comments, javadocs or strings too.
Bas