Does Visual Studio or Resharper have an auto-completion overwrite feature similar to Eclipse? - visual-studio

Sometimes I'll have classes/methods/variables with similar naming. For example, GetABar() and GetAFooWithABar() (assuming for the sake of example that these aren't horrible names to begin with).
I get into situations where I want to change one of the calls from the former to the latter, and when I start typing in the middle of the name, I'll get an auto-complete suggestion. If I select the suggestion, the following results:
GetAFooWithABarABar()
In Eclipse, there's a handy feature called completion overwrite which you can set as a default, or select on the fly by holding down Ctrl when you select the suggested term. Does Visual Studio or Resharper have a similar feature?

In ReSharper, you get a different result if you complete with Enter or Tab. If you hit Enter, it will insert the text, as you describe above. But if you hit Tab, it will replace the text to the right of the text caret, and should give you the result you're after.

Related

Visual Studio column selection - Select by word, not square

This seems like something I would have found hundreds of topics on. Yet I didn't find a single one. I wonder if no one cares or if I just overlooked something obvious.
In Visual Studio when you select a column and want to select the word your cursor is at in each line, when you do CtrlShift+(ARROW KEY), then it doesn't select by word as it SHOULD, but instead it selects a square.
BAD BEHAVIOUR (which VS has):
GOOD BEHAVIOUR (which would be expected, and is in every other IDE):
The Visual Studio ALT select is rendered useless in half the cases, actually in every case where you don't have the "coordinates" precisely the same on every line.
EDIT
I seem to have to explain why the VS behavior is bad, people apparently consider it ok. So the problem is that when you column select in VS, and you have it exactly like in the example, or even without tabs, you'd copy some =, though they won't be everywhere.
If you select a column like VS Code or JetBrains has it, you'll just copy WHAT IS NEEDED and that OBVIOUSLY being just the words in the column.
I have a solution for you, but you may not like it. It's using the new Multi-Caret Support in Visual Studio 2017.
Here is my example code where I want to copy only the property names (sorry for lack of inline images):
Multi-Caret Code Example
Using Ctrl + Alt + Click to click and add a caret to the end of each word. (If you screw up and click somewhere you didn't mean, like I do many times, then reclick to remove that caret and click on the correct spot.)
Multi-Caret End of Line
Now hold Ctrl + Shift and hit the ← Left Arrow. This will select to the beginning of the current word on each line.
Multi-Caret Word Selected
Copy/paste as you wish

Map keybind to specific snippet - SQL Management Studio / Visual Studio

I review a lot of code and I want to put brackets around certain text elements that lacks them. So far I've been been doing the following:
1) Highlighting the text element I want to put brackets around (only one highlight at a time)
2) Hit ctrl-k + ctrl-s to invoke the "Surrond With..." shortcut (see Edit->IntelliSense->Surround With...
3) Find my "insert bracket" code snippet and then hitting enter
I want to keybind a specific snippet to do this in one go (just like when you are commenting out a block using the keybind ctrl-k + ctrl-c. Is this possible?
This question is smiliar to Assign code snippet to keyboard shortcut in Visual Studio but its not marked as answered. Can anyone help confirm that its not possible or whether another work-around is possible.

Changing all elements of highligthed type in visual studio

I use the Productivity Power Tools which highlights all the corresponding elements that are the same as the one being highlighted. As shown below ( "col-sm-6" - purple highlight )
(I think it is Productivity Power Tools doing this. I installed it the same time i upgraded to 2013 , not sure if it is a default setting now)
What I would really like to be able to do is to change all the elements that are highlighted at the same time. So if i want to change "col-sm-6" to "col-sm-4" I want to be able to just hold down a shortcut key which will change all items highlighted.
I have a very strong feeling that this functionality exists.
It seems a lot like the functionality used when you select multiply lines while holding "alt" and then typing.
I have searched around, but cannot seem to find a shortcut for this. I could just do a copy and replace but it would be a lot easier to just hold down "ctrl" while typing.
Yes, it does already exist. If you change a variable name, all the other instances can be renamed at same time (see below). Moment you change the name, a small red bar will be seen below the name -> press Ctrl and click on that bar; it will ask you to change all other instances.
Also, for highlighting a text; there is already a extension ti visual studio present, see here http://visualstudiogallery.msdn.microsoft.com/4b92b6ad-f563-4705-8f7b-7f85ba3cc6bb

Over-enthusiastic Intellisense in VS2010 - can I tweak it?

Since I have upgraded from VS2008 to VS2010, I've been having an increasingly infuriating battle with the Intellisense.
For example, when specifying CSS styles, when I press Enter to start an new line, Intellisense (appropriately) lists available Styles to me. And if I select color and then type ':', it presents a list of color presets - often helpful. However, if I type in a space (I like them for readability) or if I type '#' to enter RGB values, it selected the default Intellisense selection, in this case inherits.
Another example is in an ASP.NET page - say I am concatenating strings, I type myString =, I get an Intellisense pop-up. If I type space or '"' (to enter a literal) or '.' (so select a property or method within a WITH block), the Intellisense selects the first entry in the list.
I can dismiss the Intellisense pop-ups with escape but it makes it incredibly slow to code.
This behaviour is different to my VS2008 set-up. I can't seem to find any way to configure Intellisense to behave differently... I really only want it to select and Intellisense entry when I type or ... at least, certainly not when I type '"' or ' ' or '.'!
Problem solved:
Being the idiot that I am, I hadn't properly checked for extensions; when I did, I found I had the Intellisense Presenter extension installed, and digging further it appear that my experience is not unique. It's a promising extension, but is currently unusable in this state.
This isn't normal. Start with Tools + Import and Export, select Reset all Settings. Next step is to run devenv.exe with the /safemode command line argument so it runs with all add-ins disabled.

How to begin a text selection in a Visual Studio macro

Long ago in a former editor, there was the ability to begin a macro, and then "open" the text selection...such that if your next action was to, say, search for some string - the text selection would then extend to that spot.
This was a great way to do fairly sophisticated operations without having to use wildcards or regular expressions.
Is there a similar facility in Visual Studio 2008?
Ctrl-= is the answer.
It is the 'SelectToLastGoBack' command, officially documented as "Selects from the current location in the editor back to the previous location in the navigation history". So, get the cursor where you want to begin your selection (preferably using something reliably repeatable like a search), start a new search (usually I like ctrl-I better than ctrl-F because I can see what it's doing, but ctrl-I seems to not work right in macros), have the search end where you want to end it (esc to close search box), and hit control equals to select back to where you started.
Unfortunately I can't really find anything that explains in detail how the editor decides what the previous location in navigation history is.

Resources