views:

40

answers:

3

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 files 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.

+2  A: 

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.

JaredPar
A: 

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.

GrowlingDog
See my clarification above.
JimDel
Thanks for the clarification, I'm glad you were able to resolve your problem.
GrowlingDog
+3  A: 

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

Options --> Text Editor --> File Extension was EXACTLY what i was looking for. Thanks!
JimDel