Refactoring inside scope in JetBrains IDE

烈酒焚心 提交于 2019-12-06 09:06:27

Here is a simpler workaround.

  1. Add a dummy var global within func1.
  2. Use the Refactor > Rename tool (Shift + F6), while selecting any occurrence of global in func1.
  3. Remove the line (place the caret in the line and hit Ctrl + Y) added in step 1.

As far as I know "current file" is the smallest scope possible.

Workaround:

To achive what you want with the least effort, I suggest to use the normal search.

  1. Search "global" (Strg + F)
  2. place the cursor before or above the first occurence of "global" in your function (to get right starting point and remove focus from the search field)
  3. click "Add Selection for Next Occurence" (or Alt+J) as often as needed
  4. rename all occurences at once by typing in the new name

some manual work needed here, but I think its the fastest way for big functions.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!