JBSnorro
JBSnorro

Reputation: 6716

Tab behavior Resharper Intellisense Options

A product like Resharper has many settings, and I can't seem to find the right settings to get the exact behavior I desire from it.

The behavior I am trying to change is this: Suppose the endresult I want is

enter image description here

but the line currently is

enter image description here

As you expect I start typing:

enter image description here

and after a tab I get this

enter image description here

but I wanted it to become

enter image description here

Does anyone know how I can change the Resharper settings in such a manner that my desired behavior is realized? Thank you.

EDIT: Note that tab does perform the desired behavior in the default VS Intellisense.

Upvotes: 7

Views: 1840

Answers (2)

Jura Gorohovsky
Jura Gorohovsky

Reputation: 10138

In this particular case, here's what you should do:

  • Go to ReSharper > Options > Environment > IntelliSense > IntelliSense Behavior, and set Automatically insert parentheses after completion to Opening only.
  • Now, with the caret right before SomeMethod(), type in Math.Ab, and complete Abs with Enter, as correctly suggested by Rob H. You'll end up with Math.Abs(SomeMethod();
  • Finally, press Ctrl+Shift+Enter to invoke the Complete Statement, which in this case will insert the required parenthesis at the end of the statement, and put the caret on the next line.

Keep in mind though that this might not be the optimal solution provided that you probably have plenty of other usages of code completion that could conflict with this kind of settings change.

If that kind of similar code modification is required in multiple places, you should possibly create a search and replace pattern instead.

Upvotes: 8

Rob H
Rob H

Reputation: 1849

Hitting Enter instead of Tab will insert without overwriting, although you then end up with

Math.Abs()SomeMethod();

Upvotes: 4

Related Questions