Question

Is there any way to include the color highlighting rules in the tmLanguage file itself?

For those who aren't familiar with it, Pro*C is sort of this mutant hybrid love-child of SQL and C, and both syntaxes are present in the file. However, there are a few Pro*C specific keyword which start or stop a big long block of SQL inside of one.

What I would like to do, is have the Pro*C keywords be different colors than the C/SQL keywords, and for the SQL blocks to have a different background color, so that they stand out. In none of the common themes are there appropriate scopes to use for this, not that I can tell. So I can't just call the Pro*C keywords "keyword.source.some-differently-colored language" (they should really be keyword.source.pro-c anyway) or the blocks "text.whatever.another-color" (using meta.block.pro-c right now).

It would be useful if I could just include the colors for these elements in the same plist that defines the syntax. Is this possible in Sublime? What's the correct way to do this?

Was it helpful?

Solution

As far as I understand it, you would have to modify the color scheme file to support what you want. Bundling the colors as part of the tmLanguage file doesn't make sense anyways. By doing that, you would basically be saying every user has to use your predefined colors, which I could imagine people wouldn't like. For example, let's say I have a white background, and you decide to make the text color white. It would look like there is nothing there.

I think the best route is to include sample "extension" of the color scheme file. Then allow the users to modify it themselves as they see fit. This would also let you use the standard naming conventions, so if they don't apply any new scopes, everything still looks okay. Of course, they can specify a more detailed scope in the scheme file to apply the proper text color/background.

What I think would be nice was if there was some way to simply extend a color scheme from a separate file, rather than needing to modify the original. Though that doesn't exist.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top