20

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).

vaughan
  • 6,982
  • 6
  • 47
  • 63

3 Answers3

26

Best way I have found is to map ALT+SHIFT+F6 to Reveal in Finder. Then just press enter and type in new name.

It's good because its very similar to SHIFT+F6 rename refactor.

vaughan
  • 6,982
  • 6
  • 47
  • 63
  • 7
    That's the best answer. IntelliJ should assume that the developer knows what he or she is doing when renaming a file. For example, we can easily delete a file. Why not renaming? Also, the question is clear about the developer's goal. – Almir Campos Mar 22 '17 at 20:59
8

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.

Software Engineer
  • 15,457
  • 7
  • 74
  • 102
  • Good idea about looking into the the memory usage. I generally have two or three IDEs open at once. It's annoying having to jump into Finder to rename. I might log a feature request. – vaughan Jun 09 '13 at 06:24
  • 1
    So default memory is ~700MB. I have changed it to 2048MB thanks to this answer: http://stackoverflow.com/questions/13578062/how-to-increase-ide-memory-limit-in-intellij-idea-on-mac – vaughan Jun 09 '13 at 09:01
0

If You are doing it many times, You can create a custom scope for the refactoring:

enter image description here

There You can narrow the scope to few files/folders/modules etc. And for very narrow scope it will work as normal rename.

Xupi
  • 92
  • 1
  • 9