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?
C# toggle comment doesn't work
kakyoism
#2
I have the same problem.
This is weird. Isn’t sublime text based on Textmate? textmake block comment still works for C#.
0 Likes
tphalp
#3
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:
<?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.
0 Likes
kakyoism
#4
Thanks, that worked. Surprised why it wasn’t provided in the first place. Anti-Microsoft?
0 Likes
prokofyev
#5
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.
<?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>
0 Likes