Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 656
vaughan Avatar asked Jun 08 '13 02:06

vaughan


People also ask

How do I rename a file in Intellij?

If you need to rename a file, select one in the Project tool window. Press Shift+F6 or from the main menu, select Refactor | Rename.

How do I completely rename a file?

Open File Explorer by going to My Computer, or by pressing Windows Key + E on your keyboard. Find the file you want to rename, select it and select Rename on the ribbon (or press F2 on your keyboard). Type the new name you want the file to have and press Enter.

What methods will rename a file the fastest?

We feel the F2 keyboard shortcut is the fastest way to rename a bunch of files, whether you are trying to add different names for each of them or change all their names in one go.


2 Answers

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.

like image 151
vaughan Avatar answered Sep 20 '22 17:09

vaughan


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.

like image 33
Software Engineer Avatar answered Sep 21 '22 17:09

Software Engineer