slim-template / ruby-slim.tmbundle

A Textmate / Sublime Text bundle for Slim
http://slim-lang.com/
MIT License
185 stars 46 forks source link

Syntax Highlight #18

Closed petervaro closed 7 years ago

petervaro commented 11 years ago

There is one frustrating thing, when you are using some kind of a texteditor. Namely, that all the attributes have the same color. Of course, this is understandable, because they are the same type, but it would be really nice, if you can create different "SyntaxType"-s, and all the texteditor's will recognize it (or at least TextMate :) ). I'm not a hacker guy, I'm a designer, so forgive me if I'm writing something stupid above, but is it possible, to create such a bundle for TextMate for example, where the bundle will collect all the attribute types, and will adding some kind of a color to them?

Because if you are using attribute shortcuts, which are soo pretty cool, then your line will look like:

This example is about an SVG xml file, where you are adding some shortcuts like:

shortcuts:

'&' => 'd'
'@' => 'fill-opacity'
'%' => 'stroke'
'|' => 'stroke-width'

delimiters:

'd' => ' '

So our code should look like this:

path&M20,80&C60,80&80,80&100,50@0%#000000|1/

which will rendered to:

<path d=" C120,20 140,20 180,20" fill-opacity="0" stroke="#000000" stroke-width="1"/>

In this example it is really hard to read all the shortcuts, and the different values, because all of them are numbers. But if "path" is bold and white, all the shortcuts are regular and yellow, and all the different contents are like: for & content green, for @ content blue, for % content red, and for | content gray, it would be so much easier to read.

I dont know, if this is possible, but I hope it is :)

Thank you guys,

Regards,

P

fredwu commented 11 years ago

Hi Peter, thanks for the explanation, I saw your PR on the slim repo. If I understand you correctly, you wanted the custom delimiters to be highlighted differently right? In that case I don't think it is actually possible to do so...

petervaro commented 11 years ago

Sort of, yes. Maybe it is just probably a hack, or something, like all the different things: operators, language keywords, comments, values, command names, parameters, classes, etc. have their colors, and what if, you can assign some of your tag's attributes to these types. Maybe it can not work, but maybe you are not using all type of "categories" in TM, I don't know. The best would be, if it will using some kind of a dynamic, automatic sorting, so no matter how many attributes you have, the bundle will always choose different "category" for it.. Am I explaining myself clearly? Because my english is probably not the best, I hope you can understand me :)

phrozen commented 11 years ago

Can this highlight Slim code the way it is in the Slim webpage? I like the way they color tags different than keywords or attributes, maybe check how are they highlighting Slim?

tshedor commented 7 years ago

I believe the original request - that operators, keywords, comments, values, attributes, etc. all have an identifying color - has been addressed. Of course this relies on the user's Color Scheme supporting separate colors for each definition, but the default Sublime highlighter distinguishes Slim markup as it does HTML from the new definitions added in #62. Closing this issue, but please reopen if I didn't interpret the issue correctly.