Sergey Shustikov
Sergey Shustikov

Reputation: 15821

Intellij Idea\ AndroidStudio prefix of created variables

When i want to create a new variable using incoming passed parameters(Alt + Enter key combination) by default i create a variable that called like a passed parameter.

For example :

public MyObject(int capacity)

When i press Alt + Enter IDE was displayed a dialog where i can choose the future variable name.

By default variable calls like a incoming parameter. - capacity

I want to add to all variables which will be created in the future prefix m automatically to get a next result :

int mCapacity

instead of

int capacity

How i can do that? And is that possible?

Upvotes: 2

Views: 307

Answers (1)

kuporific
kuporific

Reputation: 10322

If you are talking about the "Create field for parameter 'X'" alt+Enter item, you can accomplish this by

  1. Going to Preferences > Code Style > Java
  2. Under the "Code GenerationO tab, there is an area called "naming".
  3. Put an m in the "Field" row, "Name Prefix" column.

enter image description here

Upvotes: 1

Related Questions