Home Download Buy Blog Forum Support

c# toggle comment doesn't work

c# toggle comment doesn't work

Postby xeno.by on Sun Apr 08, 2012 2:05 pm

When I press Ctrl+/ or use Edit > Comment > Toggle Comment in a C# program, nothing happens. Same for Toggle Block Comment. How do I fix that?
xeno.by
 
Posts: 106
Joined: Mon Jan 30, 2012 10:03 am
Location: Lausanne, Switzerland

Re: c# toggle comment doesn't work

Postby kakyoism on Mon May 07, 2012 1:34 am

I have the same problem.
This is weird. Isn't sublime text based on Textmate? textmake block comment still works for C#.
kakyoism
 
Posts: 5
Joined: Mon May 07, 2012 1:29 am

Re: c# toggle comment doesn't work

Postby tphalp on Mon May 07, 2012 8:52 pm

Create a file called, "Comments.tmPreferences", in your "Packages/C#" directory (the location of this directory may vary depending on your OS, etc), with this in it:

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>name</key>
   <string>Comments</string>
   <key>scope</key>
   <string>source.cs</string>
   <key>settings</key>
   <dict>
      <key>shellVariables</key>
      <array>
         <dict>
            <key>name</key>
            <string>TM_COMMENT_START</string>
            <key>value</key>
            <string>// </string>
         </dict>
      </array>
   </dict>
   <key>uuid</key>
   <string>1BA75B32-707C-11D9-A928-000D93589AF6</string>
</dict>
</plist>


That should enable the comment toggle.
tphalp
 
Posts: 7
Joined: Tue Jan 03, 2012 3:22 pm

Re: c# toggle comment doesn't work

Postby kakyoism on Sat May 12, 2012 10:46 pm

Thanks, that worked. Surprised why it wasn't provided in the first place. Anti-Microsoft?
kakyoism
 
Posts: 5
Joined: Mon May 07, 2012 1:29 am

Re: c# toggle comment doesn't work

Postby prokofyev on Fri Sep 21, 2012 9:47 am

The solution from tphalp allows to add only one-line comments. But Javascript comment syntax is the same as for C#, so I have copied a Comments.tmPreferences file from Javascript folder and changed GUID just in case. Hope this will help.

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>name</key>
   <string>Comments</string>
   <key>scope</key>
   <string>source.cs</string>
   <key>settings</key>
   <dict>
      <key>shellVariables</key>
      <array>
         <dict>
            <key>name</key>
            <string>TM_COMMENT_START</string>
            <key>value</key>
            <string>// </string>
         </dict>
         <dict>
            <key>name</key>
            <string>TM_COMMENT_START_2</string>
            <key>value</key>
            <string>/*</string>
         </dict>
         <dict>
            <key>name</key>
            <string>TM_COMMENT_END_2</string>
            <key>value</key>
            <string>*/</string>
         </dict>
      </array>
   </dict>
   <key>uuid</key>
   <string>B1947974-37D6-46AA-8A0C-376D640E25F1</string>
</dict>
</plist>
prokofyev
 
Posts: 1
Joined: Fri Sep 21, 2012 9:43 am


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot] and 27 guests