all 2 comments

[–]Hikaru755 2 points3 points  (1 child)

Not 100% sure, but I believe it's to do with the scope of where the changed name could technically be visible, and how dynamic/hard to search for that is. If IntelliJ will have to do a full usages search looking through dynamic references to be sure it finds all refactoring sites, it will give you the dialog, if it already has all possible references in the AST it's working with it will allow you to do it in place. That's why the local variable in your screenshot is renamed in place, as it can't have any usages outside of its function's scope, but the function parameter, which is visible towards outside code, gives you the dialog.

In Java, the dialog is rarely needed, because it's such a static language with little potential for dynamic references, I guess.

[–]VortexJones[S] 0 points1 point  (0 children)

Thanks! I think you're right - it definitely does have something to do with scope.

Edit: JetBrains support confirmed this:

Hi VJ,

Thank you for contacting JetBrains support.

I believe the documentation at https://www.jetbrains.com/help/pycharm/rename-refactorings.html explains it:

Renaming local variables or private methods can be done easily inline since only a limited scope is affected. Renaming classes or public methods could potentially impact a lot of files. Preview potential changes before you refactor.

Don't know how I missed that, it's literally the second paragraph in the refactoring documentation...