Home Download Buy Blog Forum Support

// vs /// comments syntax hilighting

// vs /// comments syntax hilighting

Postby christoso on Thu Feb 21, 2013 7:28 pm

Hello,

When I was using the "Kate" programming editor on Linux, there was a useful distinction with syntax hi-lighting on comments (with C/C++ syntax hilighting):

// got a certain color
/// was a different color

This is really useful for having a visual difference between code I want to disable and not stand out, and actual comments within the code that I want to stand out and have a different color.

Is there a way to do this in Sublime Text 2?

Thank you,
Christos
christoso
 
Posts: 1
Joined: Thu Feb 21, 2013 7:23 pm

Re: // vs /// comments syntax hilighting

Postby adzenith on Fri Feb 22, 2013 6:37 pm

You'll have to edit your .tmLanguage file, but it should be fairly straightforward (copy and paste, add a slash?).
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Re: // vs /// comments syntax hilighting

Postby trivedia on Thu Aug 01, 2013 2:01 pm

Was any particular solution agreed upon to address this issue? If so, can you please it share it?

I am new to sublime and it seems non trivial for me to figure out how to edit the .tmLanguage file for C++ to change the highlighting on blocks of code that I would like to disable vs lines that carry information that I want to stand out.
trivedia
 
Posts: 2
Joined: Thu Aug 01, 2013 1:57 pm

Re: // vs /// comments syntax hilighting

Postby rob49152 on Thu Aug 01, 2013 10:37 pm

to the .tmLanguagefile add this before the <string>comment.line.double-slash.php</string> portion
Code: Select all
   <dict>
      <key>captures</key>
         <dict>
            <key>2</key>
            <dict>
               <key>name</key>
               <string>punctuation.definition.comment.php</string>
            </dict>
         </dict>
      <key>match</key>
            <string>(///).*?($\n?|(?=\?&gt;))</string>
      <key>name</key>
           <string>comment.line.triple-slash.php</string>
   </dict>


then in your .tmTheme file add this before the </array> line. Change the hex colour to what ever you want

Code: Select all
<dict>
  <key>name</key>
  <string>Slash Comment</string>
  <key>scope</key>
  <string>comment.line.triple-slash.php</string>
  <key>settings</key>
  <dict>
    <key>foreground</key>
    <string>#666600</string>
  </dict>
</dict>


So far the only problem I've seen with this is that when you hit return it creates only a // double slash on the next line.
rob49152
 
Posts: 14
Joined: Sat Jun 15, 2013 10:02 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 32 guests