Home Download Buy Blog Forum Support

coldfusion comment block theming

coldfusion comment block theming

Postby dreagan on Thu Jan 26, 2012 9:52 am

Is there any way to edit a theme so that it displays a background colour on lines with a coldfusion comment block, like I could do with normal comment blocks?

Code: Select all
<dict>
   <key>name</key>
   <string>Block comment</string>   --> do this also for coldfusion comments
   <key>scope</key>
   <string>source comment.block</string>
   <key>settings</key>
   <dict>
      <key>background</key>
      <string>#2D2D2A</string>
      <key>foreground</key>
      <string>#FFFFFF</string>
   </dict>
</dict>


coldfusion comment block:
Code: Select all
<!---
*   
*   this is a coldfusion comment block
*
--->
dreagan
 
Posts: 13
Joined: Thu Jan 26, 2012 7:42 am

Re: coldfusion comment block theming

Postby bizoo on Thu Jan 26, 2012 11:35 am

In a few words... the problem is probably not in the theme but in syntax definition.
Use ctrl+alt+shift+p with cursor inside your coldfusion comment block to display in the status bar the scope under your cursor.
The scope must contain "comment.block". If not, you have to modify your coldfusion.tmLanguage to specify that this block is a "comment.block" (http://sublimetext.info/docs/en/extensibility/syntaxdefs.html)
bizoo
 
Posts: 889
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: coldfusion comment block theming

Postby dreagan on Thu Jan 26, 2012 1:18 pm

oh ok, that clears a few things up. And I've had a look at that page you linked to, but I'm not getting it entirely..

I have this is my tmLanguage file:
Code: Select all
   <key>cfcomment</key>
   <dict>
      <key>begin</key>
      <string>&lt;!---</string>
      <key>end</key>
      <string>---\s*&gt;</string>
      <key>name</key>
      <string>comment.line</string>
      <key>patterns</key>
      <array>
         <dict>
            <key>include</key>
            <string>#cfcomment</string>
         </dict>
      </array>
   </dict>


Do you perhaps ahve any idea what I should change to give it the same formatting as say "comment.block.js" in a .js file? I tried changing the name to "comment.block" and "comment.block.js", but that won't work. I'm probably missing something else I need to do, right..?
dreagan
 
Posts: 13
Joined: Thu Jan 26, 2012 7:42 am

Re: coldfusion comment block theming

Postby bizoo on Thu Jan 26, 2012 1:33 pm

Syntax def. is not my cup of tea either...

What ctrl+alt+shift+p display ? comment.line ?

If so you have probably to add a "source comment.line" block in your theme.
bizoo
 
Posts: 889
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: coldfusion comment block theming

Postby dreagan on Thu Jan 26, 2012 1:47 pm

It says "text.html.cfm comment.line", but adding a comment.line block in my monokai theme.
I already have normal comment line colouring for that comment block though. I'm just trying to find out how to give it a background colour when it consists of multiple lines, like with what I did with js and css files..
dreagan
 
Posts: 13
Joined: Thu Jan 26, 2012 7:42 am

Re: coldfusion comment block theming

Postby bizoo on Thu Jan 26, 2012 2:04 pm

dreagan wrote:It says "text.html.cfm comment.line", but adding a comment.line block in my monokai theme.
I already have normal comment line colouring for that comment block though. I'm just trying to find out how to give it a background colour when it consists of multiple lines, like with what I did with js and css files..

:?
I thought that the comment block wasn't colored at all...

If I understand well, you want a background for comment block and no background for comment line ?
Is the syntax for comment line different than comment block ?
Yes you're right, I've no idea what coldfusion is ;)
bizoo
 
Posts: 889
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: coldfusion comment block theming

Postby dreagan on Thu Jan 26, 2012 2:36 pm

No, the comment syntax is always "<!--- --->", just like with html but with an extra hyphen. That's why the comment, regardless if it's multiple lines or not, gets the default comment line font colour.

I already have a "source comment.block" defined in my monokai theme, so that comment blocks in js and css get a lighter background colour, so I could insert documentation and find sections in my code more easily. But because the coldfusion comment block is regarded as a comment line, it doesn't get this background colour..
It's no big deal really, but I thought I'd give it a try, since Sublime lends itself to customization pretty nicely.

Coldfusion is a server side scripting language by Adobe. Works real nice.
dreagan
 
Posts: 13
Joined: Thu Jan 26, 2012 7:42 am

Re: coldfusion comment block theming

Postby bizoo on Thu Jan 26, 2012 3:35 pm

Sorry, but I couldn't help you much, you need someone that know how tmLanguage work.
You probably have to add a new rule in your coldfusion.tmLanguage before the existing one, something like that:
Code: Select all
         <key>match</key>
         <string>&lt;!---.*---\s*&gt;</string>
         <key>name</key>
         <string>comment.singleline</string>


In the end you need 2 different scope, one for single line comment and one for block comment.
And adapt your tmTheme to match them.
bizoo
 
Posts: 889
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: coldfusion comment block theming

Postby atomi on Fri Jan 27, 2012 1:39 am

@dreagon

I'm developing the ColdFusion/CFScript tmlanguage files at https://github.com/SublimeText/ColdFusion

The reason the comment block is set to line is so that most color themes will be able to differentiate coldfusion comments from regular html comments.

Thinking about this a little more it should not be the job of a language file to dictate style.
So I'll go ahead and push an update.

@bizoo doing a single line match like that is a good idea thanks.
atomi
 
Posts: 342
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

Re: coldfusion comment block theming

Postby dreagan on Fri Jan 27, 2012 7:30 am

Hah! Thanks, it now displays "comment.block.cfml". So I think I'm heading towards the right direction.
However.. >_> It's still not getting the desired background colour. Even though all other comment.block's from other languages do..
Do I need to add something to the monokai theme different than the code I posted above..?

Also, I'm not able to add comments anymore using the [ctr+shit+/]-command.. >.>

I want to thank you both for helping me out so far, it's been educational.. ^^
dreagan
 
Posts: 13
Joined: Thu Jan 26, 2012 7:42 am

Next

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 17 guests