Is it possible to turn of this R# IntelliSense behavior?

I'm sorry for the bad subject of this post. Since I don't know how the behavior is called I don't know a better subject.

Using ReSharper's IntelliSense, I want to type in code to show a MessageBox with a Yes and a No button. The intended result is:

MessageBox.Show("Text", "Caption", MessageBoxButtons.YesNo);


Using IntelliSense combined with live templates and camelhups, I actualy start typing:
mb<tab>Text","Caption",mbb.y

mb<tab> will expand into MessageBox.Show("Test");
Text","Caption" will overwrite the "Test" and append ,"Caption"

Then, I expect mbb to become MessageBoxButtons and .y to select .YesNo.

But... after typing "Caption",  IntelliSense already jumps to MessageBoxButtons.OK and semi selects it (it draws a dotted border around it). It seems to do this because it knows the third parameter must be of type MessageBoxButtons.
SemiSelect.PNG
Typing mbb does filter the list, but leads to an actual select of MessageBoxButtons.OK.
Select.PNG

So the next dot I type will turn into MessageBoxButtons.OK. My .y gets appended and I end up with

MessageBox.Show("Test", "Caption",MessageBoxButtons.OK.y);


In order to get the value I want, I have to watch my screen closely, notice the MessageBoxButtons.OK being activated, and use my cursor keys to select the correct entry. Or, press Esc to remove the list, and then type mbb.y. But either way, I have to watch what IntelliSense is doing.

So basically, what I would like is to not have the complete MessageBoxButtons enum in the list, but just MessageBoxButtons itself. If I want to select one of the values in it, I will gladly type in a dot to show the contents of the MessageBoxButtons enum. Personally, I don't see the use of showing all the enum values in the list anyway.

I've tried some options on the Environment | IntelliSense | Completion Behavior page, like "Automatically complete single item with:" and "Automatically insert common prefix", but I can't get the list the way I want.

5 comments

Hi,

as I work around I use the shortcut for smart complete which is SHIFT + CTRL + SPACE. Typically it shows only the enum members in such a situation.
Perhaps this will helps?

Best regards,
Sven

0

Hello Dick,

I'm afraid there's no way to disable this behavior. However we're considering
to make code completion better in the future releases and we will certainly
take this case into account. As a possible workaround, I would suggest using
'middle matching': when ReSharper shows a completion list with semi-selected
MessageBoxButtons.Ok, instead of typing 'mbb', type 'yes' and ReSharper will
limit the choice to MessageBoxButtons.YesNo and MessageBoxButtons.YesNoCancel.
Let me know if this helps. Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

I'm sorry for the bad subject of this post. Since I don't know how the
behavior is called I don't know a better subject.

Using ReSharper's IntelliSense, I want to type in code to show a
MessageBox with a Yes and a No button. The intended result is:

 "Caption", MessageBoxButtons.YesNo);]]>


Using IntelliSense combined with live templates and camelhups, I
actualy start typing: mb<tab>Text","Caption",mbb.y

mb<tab> will expand into MessageBox.Show("Test");
Text","Caption" will overwrite the "Test" and append ,"Caption"
Then, I expect mbb to become MessageBoxButtons and .y to select
.YesNo.

But... after typing "Caption",  IntelliSense already jumps to
MessageBoxButtons.OK and semi selects it (it draws a dotted border
around it). It seems to do this because it knows the third parameter
must be of type MessageBoxButtons.
Image:SemiSelect.PNG
Typing mbb does filter the list, but leads to an actual select of
MessageBoxButtons.OK.
Image:Select.PNG
So the next dot I type will turn into MessageBoxButtons.OK. My .y gets
appended and I end up with

 "Caption",MessageBoxButtons.OK.y);]]>


In order to get the value I want, I have to watch my screen closely,
notice the MessageBoxButtons.OK being activated, and use my cursor
keys to select the correct entry. Or, press Esc to remove the list,
and then type mbb.y. But either way, I have to watch what
IntelliSense is doing.

So basically, what I would like is to not have the complete
MessageBoxButtons enum in the list, but just MessageBoxButtons itself.
If I want to select one of the values in it, I will gladly type in a
dot to show the contents of the MessageBoxButtons enum. Personally, I
don't see the use of showing all the enum values in the list anyway.

I've tried some options on the Environment | IntelliSense | Completion
Behavior page, like "Automatically complete single item with:" and
"Automatically insert common prefix", but I can't get the list the way
I want.

---
Original message URL:
http://devnet.jetbrains.net/message/5284159#5284159



0

Hi Andrey,

Yes, using middle matching does help. However, it works even better when I combine it with Smart Completion.

The Smart Completion will limit the list to only MessageBoxButtons entries. Then, typing Cancel for instance will leave only MessageBoxButtons.RetryCancel and MessageBoxButtons.YesNoCancel.

0

Hi Sven,

When I use Ctrl+Alt+Space and then type mbb.y I still don't get what I want. But Andrey suggested I use middle matching, I don't have to type mbb, just the y. Combined with your suggestion this works excellent.

0

Please sign in to leave a comment.