zendesk/curly

Sublime Syntax Definition

teliosdev opened this issue · 19 comments

I recently created a Sublime Text (and, by extent, TextMate) Syntax Definition for Curly. Unfortunately, I have no clue how to package it up and distribute it; so, I thought I'd leave it open for discussion here. Tell me what I should do with it, and I'll do it.

Preview with Monokai on Sublime
The actual .tmLanguage file

Awesome! Is there a "hub" of some sort for sublime packages?

Also, if you feel like it, it would be awesome to add it to Linguist, the syntax highlighter used on GitHub! I'm not quite sure what the procedure is, but they're based on TM language definitions.

From the CONTRIBUTING.md file in the linguist repository:

We try only to add languages once they have some usage on GitHub, so please note in-the-wild usage examples in your pull request. In most cases we prefer that languages already be in use in hundreds of repositories before supporting them in Linguist.

I don't know how widely used curly is, unfortunately.

Hmm... :-/ I guess it's a bit early for that, then.

Sublime has the package control manager, and I'll take a look at adding the package to the package control manager when I get home.

❤️

Do you use sublime?

Nah, I'm a Vim man – but I know plenty of people who use Sublime and TM.

The thing in the CONTRIBUTING.md is partly why I haven't added liquidscript to linguist.

Awesome XD

Looks good, except one thing – it looks like the HTML highlighting takes over when the curly is inside an HTML tag or an HTML tag attribute:

screen shot 2015-01-04 at 21 24 44

Unfortunately, this is the case if only because it is the logical conclusion of both how Sublime's syntax highlighting works and how I defined the syntax for Curly. I'll see if I can fix it, but I'm not sure if it's possible.

Alright, so, here's some good news and some bad news.

Good news: I just figured out how to enable HTML snippets in Curly templates (something you couldn't do before; for example, if you were to type <div></, in HTML Sublime would autocomplete the tag for you; Curly templates now do the same).

Bad news: I can't fix that issue without essentially copying the entire definition of HTML into the Curly tmLanguage (which, needless to say, is a bad idea). Unfortunately, our issue relates to the block syntax highlighting that strings (and HTML attributes) are defined in - so highlighting within block syntax definitions would be impossible for us. Erb gets around this by actually being a part of the HTML.tmLanguage definition.

Sorry, I wish I could do more about it.

I think it's fine as is – I guess it can always be improved further in the future.

❤️

I'm going to close this, as any issues that are related to this can be opened on the repo itself. The repository can be found here: https://github.com/medcat/CurlySyntaxDefinition

👍

I just added the language-curly package to atom. I hope that's ok.

dasch commented

❤️