tags:

views:

44

answers:

3

In Resharper when I go back to edit some existing code.. eg. wanting to insert a String.Format into this code:

<td>
    <%= Html.Encode(item.Address) %>
</td>

I move the cursor to before 'item' and type in 'String.F', getting Resharper's intellisense completion list that includes the 'Format' method.

However if I press TAB then it replaces 'item' with '.Format()'

Is there a way to use completing without replacing the existing text?

+1  A: 

Stumbled upon using Enter instead of TAB to choose from the completion list. That does exactly what I want. It surrounds (in this case) 'item.Address' with the String.Format( .. ).

David Gardiner
+1  A: 

You could also use the String.Format surround template but you may have to map a hotkey to it for easier access.

CyberDude
You are right, though I was really thinking of the more general case - String.Format was just a good example.
David Gardiner
+2  A: 

There are two techniques you can use.

The first is to use the Enter key, the second is to pop a space between where you are going to start typing and the next bit of code, which will prevent the next bit of code from being overwritten.

Sohnee
Down-side of the space technique is that you then have to hit the back-arrow.
David Gardiner

related questions