In Visual Studio 2012, when I want to comment out one or more lines in a CSS file using the /*
and */
characters, VS always automatically adds the closing comment characters */
right after I type the starting comment characters. So if I start with this block of code:
.appGrid { display: -ms-grid; -ms-grid-columns: 120px 1fr; -ms-grid-rows: 140px 80px 1fr; }
and I want to comment out the -ms-grid-rows
line, I type /*
at the beginning of that line. This is what I want to see:
.appGrid { display: -ms-grid; -ms-grid-columns: 120px 1fr; /* -ms-grid-rows: 140px 80px 1fr; }
Instead, VS adds the */
characters as soon as I finish typing the /*
characters, like this:
.appGrid { display: -ms-grid; -ms-grid-columns: 120px 1fr; /**/ -ms-grid-rows: 140px 80px 1fr; }
I then have to manually delete the automatically-added */
and re-add it where I actually want it...in this case at the end of the line I'm trying to comment out.
How can I stop VS from automatically adding the */
characters? I couldn't find any option to disable this behavior in Tools>Options>TextEditor>CSS.
For reference, I'm using VS2012 Premium.
The /* */ comment syntax is used for both single and multiline comments. There is no other way to specify comments in external style sheets. However, when using the <style> element, you may use <!
If you select a block of code and use the key sequence Ctrl+K+C, you'll comment out the section of code. Ctrl+K+U will uncomment the code.
In VB . NET, you write a comment by writing an apostrophe ' or writing REM . This means the rest of the line will not be taken into account by the compiler.
I'm afraid there isn't an option to change this in Visual Studio, at least not one I can see. I've had the same issue sometimes, and generally use three ways around it:
The first is the best method, but if I've already started typing 2 or 3 are enough to get through the break in flow!
Visual Studio - Tools - Options - Text Editor - C/C++ - General - Uncheck 'Automatic brace completion'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With