Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij IDEA: Make refactor > Rename not select the whole word

Tags:

When I press my shortcut to rename a variable (precisely it's the "Main menu" > "Refactor" > "Rename..." shortcut), the entire word is selected.

Is it possible to change the behavior so that simply the refactoring is activated and the cursor stays in position (it already does, this is fine) and that I can directly add or remove a character?

Right now, if I have a variable "myVarible" and I put my cursor between "i" and "b" to add the "a", press the shortcut, and type an "a", my entire variable becomes an "a", as the entire word was selected by the shortcut.

In Eclipse this seems to be the default behavior already, and I liked it much better. How can I change this in Intellij?

like image 582
BAERUS Avatar asked Apr 26 '17 08:04

BAERUS


People also ask

What is rename refactoring?

Enterprise Developer enables you to rename all or selected occurrences in the workspace of variable, section and paragraph names (in native COBOL), of identifiers (in managed COBOL), or of COBOL types that are referenced in Java code and vice versa.

How do I refactor variable type in IntelliJ?

In the editor, highlight or place the caret at a type you want to refactor. Press Ctrl+Shift+F6 or on the main menu, select Refactor | Type Migration. In the dialog that opens, specify the new type and scope where to look for the usages. Preview and apply the changes.

How do I rename a feature in IntelliJ?

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

How to rename a file in IntelliJ IDEA?

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. When you invoke the rename Shift+F6 action, IntelliJ IDEA displays and next to the highlighted element. You can press Tab to open the context menu and select the additional rename options.

How do I perform a refactoring in IntelliJ IDEA?

When you click Preview, IntelliJ IDEA opens the Find tool window with the results of found usages where you can check the results and confirm the refactoring ( Do Refactor ). Next time you invoke the Rename refactoring, IntelliJ IDEA remembers the options you have specified inside the Rename dialog.

How do I rename the parameters of a method in IntelliJ?

By checking the first option in the confirmation pop-up, IntelliJ matches any mention of the parameters in the Javadoc comment of the method and offers to rename them as well: /** * Adds firstNumber and b * @param firstNumber the first number * @param b the second number */ public int add(int firstNumber, int b) {...}

How do I create a new field in IntelliJ IDEA?

In the Introduce Field dialog, we can select to initialise this field in the Field declaration, give it a name such as theWeatherIs and select to replace all four occurrences of it in the code. When we press OK, IntelliJ IDEA creates a new field at the top of our class:


1 Answers

You can do this by going to Settings -> General -> Refactoring and just deselect "Preselect old name" or just type Refactor in search box in settings so it will automatically go on above menu.

like image 90
Priyank Jain Avatar answered Sep 18 '22 01:09

Priyank Jain