I have recently started working in Visual Studio 2013. Before this I worked extensively in Qt's IDE. One feature I really liked in Qt was that you could highlight a block of code and press CTRL+/ to comment each line in the block, then if every line in the block was already commented out, you could press CTRL+/ again to uncomment the lines. I figured out how to set the comment block shortcut in VS to CTRL+/ but I can't figure out a way to set the uncomment to that as well if everything is commented, like in Qt. Is there a way to do this? Thanks!
You can't toggle comment like that in visual studio without using micro or third party extension, but I know for a fact that you can do it with Resharper, take a look at this.
Related
My question is there code completion for Visual studio like in Netbeans where you cycle the buffer with ctrl+k, when you type something?
There's now a nice extension called Simple Autocomplete which adds one command simpleAutocomplete.next that you can map to a shortcut of your choice.
No, there isn't a similar feature in Visual Studio.
The traditional Visual Studio autocomplete is using intellisense.
When you start typing, intellisense may bring up a drop down with suggestions. In that case you can tab to complete using the current suggestion or use the arrow keys to choose another.
Ctrl-Space (or Alt-Right arrow) will bring up this intellisense menu if it's not up.
I find it does a pretty good job overall.
Some extensions like Resharper or Visual Assist offer their own code completion or other similar features (like Suggestion List for Visual Assist).
I know it's been ages since I asked this question but I found the next best thing to do this. What I would suggest is to use VsVim extension and to use Vim's anyword completion; however, in order for this work, what must be resolved is the keyboard shortcuts that conflict:
Go to "Tools options" in Visual Studio.
Then go to VsVim category(alternatively you can search "VsVim" and
should bring the options) and click keyboard.
As far as I know vim deals with this type of completion with these keys
CTRL+P and CTRL+N so what we do is to let Visual Studio give up
these keybindings and let VsVim deal with it by Selecting from the drop
down of the keys(CTRL+P and CTRL+N) and let it be "Handled by VsVim".
I hope this has helped someone out.
Because of the lack Intellisense in Sublime, I prefer to using Visual Studio to code C# and Pycharm to Python.
ctrl + d in Sublime can select mutiple same word in text. So I can alter the selections on same time. It is convenient to alter the name of same variable in a function. How can I do that in my other editors?
The Ctrl-D multiple selection tool is one of its greatest features of Sublime Text 2 and is sorely lacking in other editors and IDEs.
Visual Studio doesn't have it built-in but there's a MultiEditing plug-in for it.
IntelliJ, which PyCharm is based on, doesn't have it either but it's apparently being planned for a release that should be out soon. See this blog comment (and the link in it) for more.
Meanwhile, you can use the rename refactoring tool in Resharper (for Visual Studio) or in PyCharm. It's not the same as multiple selections but is very useful functionality in its own right.
A nother IDE that does support it is Webstorme - alt+j. you can read the stackOverflow discussion about it here : How can I select next occurrence in IDEA editors
I just tested it on Webstorme10, and it works perfectly, just like in Sublime.
Try ctrl + h. It is the standard shortcut in many editors for replacing text.
I'm using the Surround With feature in Visual Studio with some custom code snippets. Is there a way to configure visual studio (or a custom surround snippet) to treat the entire line like it is selected, if there is currently no selection?
The same functionality is provided when you do a keyboard shortcut such as Ctrl+C, Ctrl+V etc. If you have no selected text, it performs the action on the entire line.
If someone still wants to answer this as far as doing this with Visual Studio's native functions, they can - However it was pointed out to me in a comment that resharper does this automatically. Which is something I did not realize. Seem's I'll be moving all my VisualStudio surround snippets over to Resharper Surround templates!
I have a stack of code snippets imported into Visual Studio. Just recently, they have stopped displaying in Intellisense.
If the keyboard shortcut doesn't bring up anything else on IntelliSense, then I can tab and the code snippet is inserted just fine.
However, if the keyboard shortcut for the snippet happens to also bring up other items in IntelliSense, tabbing will select the first of those items, so I actually can't use the code snippet at all!
Does anyone have any ideas why IntelliSense would be unable to list my code snippet shortcuts? I started using ReSharper recently, but that wouldn't be the problem surely?!
Thanks for your help
David
It is certainly connected to installing Resharper. First thing it does is turn IntelliSense off. Check this question for help with preserving your snippets.
I know I am late to the party but you can use snippet editor to copy your snippet then paste it into Resharper through the live template editor. The code appears to be compatible. I did that with several of mine and it works just fine.
Since ReSharper 4 Visual Studio code snippets are imported into ReSharper as live templates. That means you can invoke any code snippet by pressing Ctrl+J.
All the scripts imported in Vs are available on this popup menu.
I'm using Visual Studio 2008 and I'm used to C# where when Intellisense pops up, I select what I want by hitting enter and it doesn't skip down to the next line. In VB when I hit the enter on intellisense, I jump to the next line. Does anyone know where the setting for this intellisense option might be?
Hitting the SPACEBAR or TAB key in VB does the same thing that ENTER does in C#.
I know that this doesn't really answer your question, but intellisense is designed to work so that you just push the "next" character to choose the highlighted item (such as open parenthesis, period, semi-colon, etc).
I was bothered by this behavior in VB as well. This will be fixed in the next version of Visual Studio with a new setting for enter-key behavior.
https://github.com/dotnet/roslyn/pull/11873
Corrected link: https://github.com/dotnet/roslyn/pull/11769