Search code examples
intellij-idearefactoring

How to rename a file in IntelliJ without finding usages?


I am developing a Node.js project in IntelliJ.

The only way to rename files seems to be Shift+F6 which attempts to find all usages which takes too long (~30s - 1min).

Is there a way to simply rename the file without searching for usages?

This only happens when code is stored in Modules (which is necessary to be able to compact empty middle packages).


Solution

  • No.

    IntelliJ must find the usages to rename them, otherwise you're just renaming the file, not refactoring. If you only want to rename the file, use the mv command from a terminal. You can also tell IntelliJ not to look in strings and text, which speeds things up somewhat, but is probably a bad idea in a javascript project (where almost everything is string or text).

    I use rename a lot, and on my codebase, which is pretty big, it only takes a couple of seconds. Maybe intellij needs more memory to operate in, so you could try increasing that.