Does anybody know if there is a way in Visual Studio 2010 to highlight and comment out lines in CSS files like you can with all other files (by clicking a button)? Perhaps a Visual Studio extension? Commenting them manually is cumbersome.
相关问题
- How to know full paths to DLL's from .csproj f
- Importing NuGet references through a local project
- Adding a timeout to a render function in ReactJS
- Visual Studio 2019 - error MSB8020: The build tool
- 'System.Threading.ThreadAbortException' in
Unfortunately the regular commands for commenting and uncommenting (Ctrl+K+C and Ctrl+K+U) don't work for CSS. Instead, you'll need to record or write a macro that does this and attach it to your own shortcut.
To comment the selected text (note, this is quick and dirty and therefore comments it as a single block):
Update
This new one below works more like the regular comment command and comments on a line-by-line basis. It means you don't have to select the text before hand. This also does all the changes as a single undoable operation and checks the file extension so that you can assign this to the regular shortcut and it will work for all files.
Update for Uncommenting
This macro performs the reverse task. Again, it's implemented so that it will work for all documents if required by checking the file extension and deferring to the standard
Edit.UncommentSelection
command for non-CSS files.Update 18Oct2012
As per dirq's answer, there is an extension, Web Essentials that provides CSS commenting and uncommenting. I would recommend using this over the macros above as it provides other great support besides just the CSS commenting shortcuts.
There's an extension available that works better than the macro: Web Essentials. Check it out. http://visualstudiogallery.msdn.microsoft.com/6ed4c78f-a23e-49ad-b5fd-369af0c2107f