10

PyCharm provides option to rename text in different scopes via Shift + F6. By default the rename scope is set to Project Files. Every time I need to rename something I have to either select current file in scope option or select exclude in refactoring prompt. Is there an option to set rename scope to Current File by default in the pop up specific to a project or for whole IDE?

I found this similar question from 2016, WebStorm limit refactor scope to current file only.

EDIT: Ctrl + R seems to get the job done for my current requirement of renaming within current file by using replace all. I would still prefer to know if default option setting is available.

enter image description here

LazyOne
  • 158,824
  • 45
  • 388
  • 391
B200011011
  • 3,798
  • 22
  • 33
  • 4
    1) A ticket for PyCharm: https://youtrack.jetbrains.com/issue/PY-41064 -- no activity there. – LazyOne May 24 '21 at 12:35
  • 5
    2) [A comment here (IntelliJ IDEA / Platform-wide ticket)](https://youtrack.jetbrains.com/issue/IDEA-228855#focus=Comments-27-3885517.0-0) tells that the current behaviour (not remembering the scope from the previous invocation) is intended. It also has [duplicate ticket (quite recent one)](https://youtrack.jetbrains.com/issue/IDEA-259871) .. so for me it looks like devs do not currently plan to change anything here. **P.S.** https://youtrack.jetbrains.com/issue/WEB-21681 -- ticket for introduction of the `Current File` scope for Rename refactoring dialog. – LazyOne May 24 '21 at 12:38
  • Thanks for the ticket links. It seems there isn't much interest in this feature. So far `Ctrl + R` is quick workaround instead of selecting from dropdown. – B200011011 May 24 '21 at 13:46
  • 1
    Maybe it's faster .. but not safer. E.g. in case if you have the same variable used in few different methods/classes etc -- sorry, I'm more of a PHP person using "1 class per file; no global scope, mainly classes; not re-using variable for diff purposes in the same scope" approach where this is not an issue for me (the default scope is already good in almost all cases). Anyway: I suggest you ping that #1 ticket -- see if devs have anyting to say there (do not mention the #2) – LazyOne May 24 '21 at 13:58

0 Answers0