Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude comments and strings while refactoring with Android Studio

Tags:

Rename Method re-factoring not only rename the variables but anywhere including comments (it can not be sure if string in comments is really variable name).

For example:

class ABC{    private String username;     private void X(){     String str = "username";    } } 

Now, after renaming the class member username, Android Studio will Behave like:

class ABC{    private String mUsername;     private void X(){     String str = "mUsername"; // it should be remain same as String str = "username";    } } 

Is there any way to change the Re-factoring Setting in Android Studio?

like image 445
Yasir Ali Avatar asked Jun 28 '13 07:06

Yasir Ali


1 Answers

After a struggle, i got the solution. During re-factoring/renaming the variable/member, it will display a popup. In this popup, you will see a sentence

"Press Shift+F6 to show dialog with more options"

Now if you will press "Shift+F6", a dialog will open for Re-factor-Setting.

Here, un-check "Search in comments and strings" .. Thats it..

Thanks for replies..

like image 99
Yasir Ali Avatar answered Sep 20 '22 23:09

Yasir Ali