Renaming and Alain's ideas ;)

> 2: there is no way to rename anything without a dialog, so my suggestion
> doesn't add anything that's not there. It just changes the way to
> trigger it.

Eclipse has a nice rename-in-file, which switches to a kind of
live-templates-mode. Renaming then (within the editor) automatically renames
all occurences in the file. I don't know, whether it would work for external
(to the file) references.

Tom

6 comments
Comment actions Permalink

Hello Thomas,

>> 2: there is no way to rename anything without a dialog, so my
>> suggestion doesn't add anything that's not there. It just changes the
>> way to trigger it.
>>

Eclipse has a nice rename-in-file, which switches to a kind of
live-templates-mode. Renaming then (within the editor) automatically
renames all occurences in the file. I don't know, whether it would
work for external (to the file) references.


This would be a nice variation to have for renaming of local variables. (That's
the way I use it when working in eclipse).

For other renaming refactorings I prefer to have a quick glance at the preview;
that makes a dialog a more natural first step, imho.

-tt


0
Comment actions Permalink

>>> 2: there is no way to rename anything without a dialog, so my
>>> suggestion doesn't add anything that's not there. It just changes the
>>> way to trigger it.
>>>
>> Eclipse has a nice rename-in-file, which switches to a kind of
>> live-templates-mode. Renaming then (within the editor) automatically
>> renames all occurences in the file. I don't know, whether it would
>> work for external (to the file) references.


This would be a nice variation to have for renaming of local variables.
(That's the way I use it when working in eclipse).


Agreed. I often use the Rename (Shift-F6) refactoring to rename a local
variable (most often used when refactoring the algorithm in a method). A
"Quick-Rename" which doesn't involve a popup dialog would really speed
things up and make editing smoother.

However, I don't think I like Alain's idea that it should automatically
start when I edit a local variable name. Sometimes I want to change the
name without it affecting all other references. An editor is an editor
foremost. Standard editing actions like changing text should be the
default behaviour. One shouldn't have to start editing and then cancel
an automatically triggered renaming mode just to continue with normal
editing. I would prefer it to be initiated by a shortcut (Alt-F6?).

Ciao,
Gordon

--
Gordon Tyler (Software Developer)
Quest Software <http://www.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: (416) 933-5046 | Fax: (416) 933-5001

0
Comment actions Permalink

However, I don't think I like Alain's idea that it should automatically
start when I edit a local variable name. Sometimes I want to change the
name without it affecting all other references. An editor is an editor
foremost.


Exactly why I said no to popping up anything as I type. Alain said he
would make it optional, fine but by default it should be OFF not ON.

Thanks
R

0
Comment actions Permalink

Gordon


1/

> An editor is an editor foremost.


Maybe, but IDEA is not an editor, like Notepad is.


> Standard editing actions like changing text should be the default
behaviour.


IDEA is not an standard 'editor', nor a 'super-editor', it's a tool that
must help you produce good code that you understand, with the smallest
effort.
Its building blocks are not 'Insert char', and 'Back space', they are
'Rename', 'Move', 'Safe Delete' etc..

IDEA doesn't let you "Save" files either, like ALL editors do, but
that's fine. It's even better.



2/
> However, I don't think I like Alain's idea that it should
automatically start when I edit
> a local variable name. Sometimes I want to change the name without
it affecting all other references.

'Sometimes', 'Often'

If it's implemented smartly - **1 -, I'm sure you wouldn't be bothered.
Once in a while - 'Sometimes' -, you'd just press 'Esc' to cancel the
current InPlaceRenaming process, without thinking.

**1: InLineRenaming should NOT happen on EVERY symbol name change.
Typically, it should not be triggered on invalid and/or not parsed code.

Ex: duplicating a line - Ctrl-D - to avoid retyping

step 0
int x = size.x ; action Ctrl-D step 1: int x = size.x ; int x = size.x ; The 2nd line doesn't compile, and/or hasn't been parsed yet => no automatic InPlaceRenaming. => you can edit the usual way, by typing, to obtain step 2: int x = size.x ; int y = size.y ; I'm sure there would be little complain, if it were implemented this way. I'm sure there would be other optimizing ideas, after a few hours of usage, like proposing name variable automatically, in cases like : int x_1 = 1 ; int x_2 = 2 ; int x_]]>2 = 2 ;



Alain


0
Comment actions Permalink

Hello Alain,

2/

>> However, I don't think I like Alain's idea that it should
>>

automatically start when I edit

>> a local variable name. Sometimes I want to change the name without
>>

it affecting all other references.
'Sometimes', 'Often'

If it's implemented smartly - **1 -, I'm sure you wouldn't be
bothered. Once in a while - 'Sometimes' -, you'd just press 'Esc' to
cancel the current InPlaceRenaming process, without thinking.


I think I understand your general idea, but
1) It seems to take control away from users. (I feel it may work against
you if you have the 'wrong' editing style)
2) It's quite unexpected for new users ('incompatible' to other source code
environments)
3) I have the feeling that implementing it would reveal a number of corner
cases where behaviour might be contraintuitive.

Apart from these objections I would certainly give it a try if it was available
as a plugin ;)

My proposal for the inline 'quick rename' is more modest, and similar to
the eclipse functionality:
1) The refactoring is triggered by a hotkey (Ctrl-Shift-F6?) or an intention
selection.
2) The renaming editor should be inline, similar to the 'live template' editing
mode.
3) It should give a clear visual indication that a special kind of editing
is going on, similar to the live template UI.

Apart from all that there are at least three choices:
a) Rename is only local in file (the eclipse way). Potential to break valid
code.
b) Restrict 'quick rename' to locals and private members.
c) After 'quick rename' (after Esc/Tab/loss of focus) apply existing renaming
logic (e.g. get/set).

My own preference would be for (b), since for me renames fall in either of
two categories:
1) locals and privates: renamed often, very low risk. I want these to be
as fast as possible.
2) public and package fields: renamed less often, I sometimes take a quick
glance at the preview. The dialog and preview is ok here.

Regards,

-tt



0
Comment actions Permalink

Taras Tielkes wrote:


I'll just AOL here and say "me too". ;)

Ciao,
Gordon

--
Gordon Tyler (Software Developer)
Quest Software <http://www.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: (416) 933-5046 | Fax: (416) 933-5001

0

Please sign in to leave a comment.