Open b3054443-6b5d-4bfb-bd32-a5a9422ca82e opened 10 years ago
say, for renaming a variable in a block of code, or in a function, or renaming a method name in a class, etc. nothing fancy here, a button in the replace dialog will do. i think the proposed functionality is needed much more often than the currently implemented replacing within the whole file.
This is an interesting idea, but not a high priority. One can selectively replace now with [Find], [Replace], and [Replace+Find] buttons. I have been thinking about improving the Search and Replace dialogs, so I will not immediately reject this. Some additional comments follow.
A changed method name has to be replaced in all use sites, not just in the class definition. Some editors will make replacements across multiple files.
Renaming a local variable in a def statement, or the loop variable in a for statement (using the [X] whole word option) would be good uses.
[Replace All] could be defined to only apply to a selection when there is a selection.
The new feature would be more useful if there were a 'select suite' or 'select statement' command that would, for instance, select an entire def statement if the cursor were on the first line, with the 'def' keyword.
Currently, on Windows, the 'found' highlight does not work when there is a selection. That might be a simple fix. There is already an issue for fixing Search dialogs.
Do you know of any other editors with this feature?
replacing across multiple files is something i personally considered too fancy for idle, but that's a great feature. the same goes for smart selections like selecting multiline statements. if they don't contradict idle's simplicity ideology they are great canditates to be implemented.
as to the editors currently implementing replace-in-selection, notepad++ is one. it actually does exactly what terry suggested, activating an "in selection" checkbox only if something is selected. (visual studio, and python tools for visual studio in particular, have some replacement and refactoring abilities too.)
---------------------------------------------------------------------- now, guys, i'm very sorry that i have to return to my already mentioned off-topic issue: i'm not getting emails from bugtracker. not even in spam. i was about to file a bug on the metatracker but it seems i can't even register on it because i am not receiving that confirmation email to activate my account! i don't know if http://psf.upfronthosting.co.za/roundup/meta/issue541 is related to my problem. it seems it might be. what am i to do?
About your email problem: post to core-mentorship list and if you cannot do that, write to Ezio Melotti and/or R. David Murray directly, as they are tracker maintainers.
-0 on doing this. The current Find/Replace works pretty well even for replacements within a block (though it takes a few clicks to apply them one at a time). In general, IDLE aspires to be minimalist and favor rapid learnability over having more features and options
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields: ```python assignee = 'https://github.com/terryjreedy' closed_at = None created_at =
labels = ['expert-IDLE', 'type-feature', '3.10']
title = 'idle editor: replace all in selection'
updated_at =
user = 'https://bugs.python.org/bagratte'
```
bugs.python.org fields:
```python
activity =
actor = 'terry.reedy'
assignee = 'terry.reedy'
closed = False
closed_date = None
closer = None
components = ['IDLE']
creation =
creator = 'bagratte'
dependencies = []
files = []
hgrepos = []
issue_num = 22460
keywords = []
message_count = 5.0
messages = ['227260', '227639', '227797', '227815', '250148']
nosy_count = 4.0
nosy_names = ['rhettinger', 'terry.reedy', 'markroseman', 'bagratte']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'test needed'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue22460'
versions = ['Python 3.10']
```