Introduce Field and keyboard shortcuts

I typically use this to convert magic numbers and strings into constants.
It would be really, really, nice if there were a keyboard shortcut that acted like
"Introduce Const" without having to hit the dialog. If this is doable already,
please someone help me with my Resharper-fu.

8 comments

Oy, was hoping for some sort of reply to this.

JetBrains gurus, I would love to have a keyboard shortcut for "introduce local constant" and "introduce class constant"
or even for it to show up in quick fixes or something that doesn't require a dialog.

Many Thanks!

0

+1 for the introduce constant.

Also, didn't there used to be a way to get ReSharper (with some prompting) to use an UPPER_CASE_STYLE for constants? If not, please add one?

0

+1 for anything that keeps me out of the modal dialogs.

As much as R# owns its main competitor in almost every area, R#s habit of spawning modal dialogs (usually with shitty tab ordering, accelerators, etc. (Sorry, JetBrains guys, but this is one part of the product that really can't be called anything other than shitty)) really hurts its usability.

0

Hello Jeremy,

This is nice call and we can try do it better together. Take, for example,
Rename Refactoring. How would you do it dialog-less (not modal-less, because
refactoring windows are non-modal, check it) and still preserve the same
functionality?

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


JG> +1 for anything that keeps me out of the modal dialogs.
JG>
JG> As much as R# owns its main competitor in almost every area, R#s
JG> habit of spawning modal dialogs (usually with shitty tab ordering,
JG> accelerators, etc. (Sorry, JetBrains guys, but this is one part of
JG> the product that really can't be called anything other than shitty))
JG> really hurts its usability.
JG>


0

True, they are not modal, thanks for reminding me. As for a possible dialog-free alternative:

There is already an inconsistency between the renaming of local variables and everything else. Local variable renaming uses no dialog, everything else (I think) does. Lets ignore for the moment that sometimes the name editing experience when renaming local variables is a bit, well, odd ;). Renaming of things other than local variables could be made virtually identical to that of renaming local variables if R# can default (and perhaps allow the user to configure through R# options) the rename behaviour as it pertains to undo and the searching of comments and string literals. Let's assume that the (preferrably configurable) default is to enable undo and the searching of comments and string literals, as it is now (I think) for the dialog-based rename. The standard hotkey (whether F2 or Ctrl-R-R or what have you) could use the dialog-free rename variant while an additional hotkey could be provided for those times when the user wants to change one or both of those two options from their configured defaults without going into the R# options. If the user were to configure that additional hotkey, pressing it would spawn the classic rename dialog.

0

Take, for example,
Rename Refactoring. How would you do it dialog-less (not modal-less, because
refactoring windows are non-modal, check it) and still preserve the same
functionality?


I'm not Jeremy, but I have a response to that.

I never used Microsoft Word 2007 until a few months ago, when I used it on a relative's computer (I touch type, she had a report). Ignoring the Ribbon, I didn't notice any big difference. I had been correcting spelling errors for a while when I realized they had made a very subtle but powerful change. The normal menu you get to correct a spelling error now had options for correcting the formatting as well. It was so subtle that I didn't even notice it.

Consider something similar in the sense of changing the word being edited into a small, somewhat isolated specialized editor environment, focused on the kinds of things we want to do while renaming. For instance, add some margin at the beginning and end of the identifier being renamed to change the Home key into "goto the beginning of the identifier". Help me out in little ways. For instance, if I'm editing the word "contract", move to the front and type "actual", then please be kind enough to convert the "C" to upper case. Convert it back if I erase the "actual".

The little mini-editor panel like that in Word could be used for commands like "change to constant" or something like that.

You would basicly have modes without modal dialogs. Any editor panels or such should be semi-transparent (we need to see the surrounding code), responsive to keyboard or mouse, and should be easily dismissed. In fact, they should be dismissed by the same keystrokes or other gestures that dismiss rename mode right now, for hand compatability.

Just two cents, for free.

John

0

Is ctrl-alt-d what you're looking for? In the popup, alt-s to make it a
constant.

"jason.west" <no_reply@jetbrains.com> wrote in message
news:15235445.30641218726580837.JavaMail.jive@app4.labs.intellij.net...

Oy, was hoping for some sort of reply to this.

>

JetBrains gurus, I would love to have a keyboard shortcut for "introduce
local constant" and "introduce class constant"
or even for it to show up in quick fixes or something that doesn't require
a dialog.

>

Many Thanks!



0

Well, now that I'm playing with it. It seems in the latest version 4.924 ctrl+r, v does the "introduce local const" just like I expected with no dialogs.
Resharper-fu improved!

Now, to click my heels and and find the class const.

0

Please sign in to leave a comment.