I did a ctrl K + ctrl C (adds //
to a line) on a lot of lines of code that I need uncommented. What is the quick key method to uncomment code in Visual studio?
Ctrl+K, Ctrl+U removes the //
comments
Ctrl + K, Ctrl + U.
There is also a button for it on the Standard toolbar.
ctrl + / can be used for adding and removing comments.
If you're using Resharper, there is a much nicer alternative:
just
right Alt + /
for both
By using this single shortcut, you can simply toggle between commenting/uncommenting code, without having to remember/switch between two shortcuts for each.
Ctrl + K + C (to comment) and Ctrl + k + U (to uncomment the code)
Or
or use Ctrl + / (for the same)
Qwerty: Ctrl + /
Azerty: Ctrl + :
Just wanted to add, that in the latest version of VS, ctrl + u
makes it caps. They instead made it a toggle command, so it is actually just ctrl + k
again to make it uncommented.
I have the german keyboardlayout. VSCode-x64-1.52.1 To leave a comment: You have to highlight the code, then push Ctrl + # or Ctrl+K, stay at Ctrl and push C
to commen out: Ctrl + #, it toggles on/off the comment or Ctrl + K, stay at Ctrl and push U
Mine was a bit different. It is ctrl-shift-C to comment and ctrl-shift-alt-C to uncomment.
I am using Visual Studio Community 2017.
Ctrl + Q alternates between comment and uncomment. Unfortunately Ctrl K Ctrl U does not work in few environments, rather it adds instead of removing. My case on windows, using composer file I faced Ctrl K Ctrl U not working. I m using VS Code, ver 1.36.1
links to all keys short cuts: https://code.visualstudio.com/docs/getstarted/keybindings
In Visual C++ 2019 Ctrl + Shift + / both comments and uncomments.
On MacOS you can Command
+ /
to comment and uncomment.
You can't use any of those key combinations as all the answers do not work in vs2022.
Not a single one, all the answers are useless wranglings.
These answers are simply comical!
ok, one works cntrl-k, then type cntrl-c.
to uncomment Ctrl + K then Ctrl + U. press K then C or U while holding down control.
But there is another couple of ways In VS2022 select View > Toolbars > Text Editor.
This toolbar has a comment and uncomment button on it. You can highlight as much of your code as you want and then press the comment button and it will comment it all out at once, and vice versa for uncomment.
You can collapse a sub, like press arror on left by line numbers Then highlight the entire collapsed code stub, and click the comment button on your toolbar. There's also an uncomment button that you can use to uncomment a sub or a block of commented code...
Windows: Shift+Alt+A is a toggle. Simply choose your lines of code you want to comment out then Shift+Alt+A, then simply choose your lines of code you want uncomment and then Shift+Alt+A.
© 2022 - 2024 — McMap. All rights reserved.