Can I enable the "Comment out the selected lines" feature for working on text files in Visual Studio?
Can I enable the "Comment out the selected lines" feature for working on text files in Visual Studio 2008 or 2010? I'd like the ability to use that function on fi开发者_StackOverflow中文版les other than normal code related files. When I open a TXT file the comment and un-comment buttons are disabled. Is there a way to change that?
Thanks
Clarification: I use this text file to hold instructions for another program. Each Line holds one instruction. Sometimes I need to comment out blocks of instructions at a time. We use the "//" characters to accomplish this.
Could you give your filename a C++ extension (e.g., .h, .cpp) to fool the editor into thinking it's a C++ source file?
It appears you could also give it any extension and map that extension to a particular editor in: Options --> Text Editor --> File Extension
Unfortunately you cannot. The "Comment Out Selected" lines feature is a language specific feature and the text language service does not implement it (it's actually hard to call it a language service in general).
Besides what would commenting out a line in a text file look like? You could use Replace all + a regular expression to achieve the same thing though.
I'm curious what you would expect a commented line in a text file to do, or what it would look like. A commented line in a programming language causes that line not to be executed, but since a text file is just data, it doesn't execute anything anyway.
精彩评论