Why does Resharper intellisense replace my code? - c#

With Resharper 6.1, when I type something like...
widget.PropertyA
and then put my cursor in front of the widget symbol like this...
|widget.PropertyA
and start typing another symbol, R# intellisense pops up. If I choose a suggested symbol, then R# replaces the widget symbol with my newly chosen symbol.
I can see how this might be useful at times, but the vast majority of the time, I just want to type more code in front of widget and don't want it to be replaced. Does anyone know if this behavior is configurable?
Thanks.

I don't believe it is configurable. It seems to be by design that Tab overwrites code. It will even highlight the segment of code that would be replaced.
Instead of hitting Tab to select your symbol, use Enter instead. It will insert the new code without overwriting the existing code.

Go to IntelliSense -> Completing Characters in your ReSharper options. At the top of that menu you can whether the Enter and Tab keys insert or replace.

The only thing you can really do is to insert an extra space before you start typing. You could request that it be changed on JetBrains' bug tracker. Let me know if you do and I'll vote for it!

Related

In visual Studio, when formating automatically, how to reduce block spacing to minimum?

When doing formatting is there an options to control and reduce spaces in blocks ?
You can try the following steps to reduce extra blank lines.
First, please use hot key Ctrl+H to open replace function box.
Second, please select the code you want to format.
Third, please choose Use regular expression and Selection.
Finally, please input (?<=\r\n)\r\n in the find box and click the Replace all.

Visual Studio 2019 Intellisense replace

I can't understand why intellisense does't want to replace line after dot with suggestion.
I pressed Ctrl + Space, selected suggestion and I expected the eoID to be replaced by fuID. But I got item.fuIDeoID = updItem.eoID;. To complete suggestion I tried to press Enter then Tab and result was same. Can someone explain how to get item.fuID = updItem.eoID; after complete selecting suggestion?
You need to highlight the part you want replaced. Currently your cursor is in insert mode (so to speak). You need to highlight the part you want replaced, bring up intellisense, and select the replacement value.
To replace press SHIFT+TAB or SHIFT+ENTER

Resharper generate auto-properties for code

I have a situation like that :
is there any way to generate all of those properties at once rather then clicking on each one ?
Whilst strictly an answer to what you asked, as R# can't do what you want, I find NimbleText (http://nimbletext.com/) to be extremely useful for this sort of thing.
You paste your C# into the top panel, add a template to the second panel, using things like $1, $2, etc for the data fields, and the resultant text appears in the third panel.
One of the most useful tools I've ever found, and free too!

What are the key bindings for scrolling through an intellisense list in Visual Studio 2015?

What are the key bindings (hot keys) for scrolling through an intellisense list in VS 2015?
For example, in the following say I want to scroll down to "Ceil":
I've tried the arrow keys, pgup/pgdown, Alt-n/Alt-p, Tab, the arrow keys on Numpad with no success. It would be nice to be able to scroll a line at a time, as well as a "page" at a time.
Note: I am using the VsVim extension, so maybe this is the problem? (although I have tried vi-ish keystrokes like "j", "k", "ctrl-j", "ctrl-k" to no effect)
My apologies if this is an obvious question, but I can't find any info about it anywhere, including under
Tools->Options->Environment->Keyboard.
The mouse works of course, but since I'm a vi user I really don't want to take my hands off the keyboard.
Many Thanks.
After three days of receiving no answer, I assumed the answer was not obvious. So I decided to look further on my own. While I was still unable to find any "official" key bindings, I was able to figure out what the problem was, and how to map the keys on my own.
First off, this is only a problem with the VsVim plugin installed. With this plugin disabled, the arrow keys, and pgup/pgdown work as expected. Also, I noticed that even with VsVim enabled the pgup/pgdown is scrolling the list a page at a time. I swear this wasn't working before, but at least now that appears to be working.
I also discovered a few properties of Intellisense that alleviate the need for scrolling. First, intellisense is pretty good about presenting contexutally aware highlighting. For instance, on Mathf I select PI a lot. So whenever I dropdown on MathF, it starts with 'PI'. This somewhat alleviates the need to scroll around looking for something. Second, I also discovered that if you're presented with a choice of Atan and Atan2, for instance, you can logically scroll to Atan2 by typing A2 and then tab completing (instead of having to type out 'Atan2'). So there are ways to logically select certain entries by typing contextual "hot keys" to logicially home in on your "target".
But still, there are lots of use cases where you simply want to scroll a line a time. I noticed that the arrow keys didn't work at all in VsVim -- even when you're just scrolling around the text. I decided I just needed to map the up/down arrows myself using Visual Studio.
To make a long story short, I mapped Alt-j to Edit.LineDown and Alt-k to Edit.LineUp. You can either do this at the texteditor level, or the global level. I just did it at the global level, since Alt-j and Alt-k are not in use by anything else, but if you're mapping a "popular" key binding you can restrict it to just Text editor mode as well.
Do this like so:
Goto Tools->Options->Environment->Keyboard.
Search for key commands containing down.
Map Edit.LineDown to your specified key.
Do the same thing for Edit.LineUp.
Here is a screen print:
Now I can use the vi-friendly Alt-j and Alt-k to scroll through the list. This is even better than the arrow keys because I can leave my fingers on the home row. Yay!

Auto complete property in asp.net c#

I have noticed many times developers use like a quick key to generate properties but I can not find what that key is. Is there a list i can look at with all the short keys?. what i am referring to is like when you do
Highlight method + F12 takes you to the reference (for example), there is one specifically that would help me a lot, the property auto complete it usually puts something like
public int something, and the color shows as green or something. Any help would be much appreciated.
This is done with snippets. The default snippet can be expanded by typing prop and then pressing TAB.
I think what you're seeing is CodeRush. If this visual is the green you're referring to, it's CodeRush:
also, if intelisence is ever "not there", simply press control + space. Works in Netbeans and Visual Studio

Categories

Resources