Bug or feature: name suggestion on introduce variable/field?

In IDEA 3.0.x when I did an introduce variable on an expression like "getChildrenReference()" among the suggested names is "children".
Current EAP only considers the trailing "camel" words, i.e. "reference" which is useless for me in many cases.

It's often true that the prefixes are attributes describing the suffix, e.g. "localPosition", where suggesting "position" makes more sense than "local".
However I also have a lot of names like "positionInContainer" where currently there isn't any sensible name suggestion.

7 comments
Comment actions Permalink

Well, I would say that it is reasonable to suggest BOTH suffix and postfix
or at least make the choice configurable. Please submit a request.


0
Comment actions Permalink

In IDEA 3.0.x when I did an introduce variable on an expression like

"getChildrenReference()" among the suggested names is "children".

I do not think it was so. Are you sure?

--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"


"Stephen Kelvin" <mail@gremlin.info> wrote in message
news:13618464.1053599106055.JavaMail.jrun@is.intellij.net...

In IDEA 3.0.x when I did an introduce variable on an expression like

"getChildrenReference()" among the suggested names is "children".

Current EAP only considers the trailing "camel" words, i.e. "reference"

which is useless for me in many cases.
>

It's often true that the prefixes are attributes describing the suffix,

e.g. "localPosition", where suggesting "position" makes more sense than
"local".

However I also have a lot of names like "positionInContainer" where

currently there isn't any sensible name suggestion.


0
Comment actions Permalink

IMO it would provide too much choices. For example, for "getLastChild" it
would provide "last", "child" and "lastChild" and for "getAbsoluteBuildPath"
should it provide "absolute", "build", "path", "buildPath", "absoluteBuild",
"absolutePath" (??), etc?

--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"

"Evgueny Vigdorchik" <ven@intellij.com> wrote in message
news:baictj$g6o$1@is.intellij.net...

Well, I would say that it is reasonable to suggest BOTH suffix and postfix
or at least make the choice configurable. Please submit a request.

>
>


0
Comment actions Permalink

I just checked again with "getChildrenReference()" and IDEA 682 (pretty old, I admit) suggests "children", "reference" and "list" (because return type is list).

0
Comment actions Permalink

I think any names from the middle can be ommited.
That would still leave six choices for "getAbsoluteBuildPath()", but would bring the number down to a reasonable 2*n from n^2 in the general case (where n is the number of camel words).

0
Comment actions Permalink

That might depend on cached information in your IDEA installation. If you
often used "children" in such situation IDEA would remember that.

--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"

"Stephen Kelvin" <mail@gremlin.info> wrote in message
news:12164684.1053610514954.JavaMail.jrun@is.intellij.net...

I just checked again with "getChildrenReference()" and IDEA 682 (pretty

old, I admit) suggests "children", "reference" and "list" (because return
type is list).


0
Comment actions Permalink

You're right, off course: When I try with getAaaBbbCcc() IDEA 3 also only suggests "aaaBbbCcc", "bbbCcc" and "ccc".
Sorry for that. I'm gonna file a feature tracker entry.

0

Please sign in to leave a comment.