Sublime Forum

Anyone able to help with a syntax issue or two?

#1

I’ve overhauled and greatly improved on syntax highlighting for ExpressionEngine files in Sublime Text. In fact, I think I now have the most complete and advanced syntax highlighting for EE code that there is. Certainly way ahead of anything I’ve been able to find in any popular editor at this point. They all stumble over a whole bunch of perfectly legal and commonplace combinations of tags, often to the extent that it’s easier to just turn off color altogether.

That said, a few minor problems remain with my syntax definition (.tmLanguage file), and before releasing it, I need some help with fixing them (mainly, handling nested brackets properly).

Is anyone on this forum semi-fluent or at least extra-competent in Sublime Text syntax definitions?

If you’d be willing to pitch in on taking Sublime Text’s support for ExpressionEngine development up a notch, please PM me or post to this topic and I’ll get in touch.

0 Likes

#2

I have written some syntax definitions on my own and modified (or inspected) various others. (I also am enhancing AAAPackageDev to make this process even easier.)

But I think that solving all these issues via PM would be a waste since there might be other people running into similar problems where your example could help or maybe there are people who know better than me and can provide other insights.
Anyway, I recommend you to use this thread to resolve your issue. Since I replied to it I will regularly check for activity (usually multiple times a day, if I’m not out).

If you need feedback “instantly” you should hop onto #sublimetext@freenode and hope that someone’s currently there for help.

0 Likes

#3

Most of the problems I’m having require installing my current syntax and evaluating it; this seems out of scope of this forum, no?

In any case there are two representative issues, that may be reproducible by anyone with an ExpressionEngine syntax package installed:

**1) EE code inside CSS (CSS definitions get messed up by EE brackets).
**

<style>
    body{ background: {!--white--} black; }
</style>
/* THIS TEXT IS TREATED LIKE A CSS COMMENT, EVEN THOUGH IT"S OUTSIDE THE "STYLE" BLOCK ABOVE. ACTUALLY, ALL LAYOUT IS BROKEN FROM HERE ON OUT, DUE TO THE THE CLOSING BRACKET OF THE EE COMMENT ABOVE, WHICH IS INTERPRETED AS A CLOSING TAG FOR THE body DEFINITION THAT IT'S CONTAINED WITHIN. THE CLOSING STYLE TAG IS IGNORED, AND EVERYTHING AFTER IS TAGGED AS IF IT'S INSIDE A STYLE BLOCK. ONLY WAY TO RESTORE ORDER IS TO ADD THE ADDITIONAL END STYLE TAG BELOW.  */
</style>[/code]
*Possible solution: inject EE definition (at least comments) into CSS and JS and PHP syntaxes?? Or use Matching Nested Constructs feature of regex
*

**2) EE comments and tags contained within quoted strings are not properly tagged as such:
**
[code]<a href="{path=blog}{!-- COMMENT --}">title</a>[/code]

**3) EE tags nested within EE tags are not handled right.** Use Matching Nested Constructs feature of regex?
[code]{encode="{webmaster_email}" title="Contact Us"}

OK… any ideas?

0 Likes

#4

Yeah, it would be really nice to actually have your current syntax. Also, there seem to be several EE packages on Github. Could you upload or link it so I can see what this is all about?

And no, this is totally fine on the forum. If people don’t want to take the effort to install a package and test it themselves then they don’t have to. However, if they do want and you make it hard for them to get relevant information about your issue they probably won’t bother about your issue and continue with the next thread. At least that’s what I think and practice.

Disclaimer: I don’t know what EE is supposed to be as of now, could easily read into that though - probably. Anyway, I’ll be away over weekend so next reply from me won’t happen earlier than Monday or Tuesday.

0 Likes

#5

There are indeed several packages on github. I tested them all and found no significant differences between any of them, at least with regard to solving the problems I’ve encountered.

I have not committed most of my changes to github yet, but you can download my early commits here:

github.com/fcgrx/ExpressionEngi … t-3-Bundle

0 Likes

#6

OK Ive not sync’ed all my changes with this github repo:

github.com/fcgrx/ExpressionEngi … t-3-Bundle

There’s a “known problems” file in the repo now, listing the remaining shortcomings of the package:

github.com/fcgrx/ExpressionEngi … blems.html

I’d really appreciate any insight anyone might have to solving those remaining issues (i.e. the original purpose of this thread).

Anyone who got here by searching for syntax highlighters for ExpressionEngine, I do believe this one is now by far the most comprehensive and accurate…

0 Likes

#7

Just a quick note - thanks for this. Seems to be working well for the most part.

And for the theme too.

One thing I notice - the / in /exp:stash:set, for example, is purple for me ( as I changed ee tags to purple by:

		<dict>
			<key>name</key>
			<string>EE tag</string>
			<key>scope</key>
			<string>ee.tag.html</string>
			<key>settings</key>
			<dict>
				<key>foreground</key>
				<string>#AE81FF</string>
			</dict>
		</dict>

…I’d like that slash to be orange as well…but can’t quite figure out which bit this is!

(would be great if Color Highlighter worked for ST3 but that’s another story…)

Any tips??

0 Likes

#8

Also some embedded SQL highlighting would be an awesome addition :wink:

0 Likes

#9

[quote=“bossanova808”]Just a quick note - thanks for this. Seems to be working well for the most part.

And for the theme too.

One thing I notice - the / in /exp:stash:set, for example, is purple for me ( as I changed ee tags to purple by:

		<dict>
			<key>name</key>
			<string>EE tag</string>
			<key>scope</key>
			<string>ee.tag.html</string>
			<key>settings</key>
			<dict>
				<key>foreground</key>
				<string>#AE81FF</string>
			</dict>
		</dict>

…I’d like that slash to be orange as well…but can’t quite figure out which bit this is!

(would be great if Color Highlighter worked for ST3 but that’s another story…)

Any tips??[/quote]

I updated the syntax to highlight the end slash of exp:stash:set and other addons. enjoy…

0 Likes

#10

not sure what youre talking about… an example would help

0 Likes

#11

Sorry - I meant if you’re using an SQL query in your EE template…but to be honest this is pretty rare.

Thanks for the / fix.

I find the auto closing tags thing annoying - that’s a sublime html thing, though, I guess? It’ keeps grabbing tags that aren’t tag pairs (like {cf_whatvever}) - instead of closing the html tag it should be closing…do you know what I mean? Any ideas about this?

0 Likes

#12

I would love to have a support for EE on Sublime. It would make development EE a lot easier for me. After installing ExpressionEngine, I usually integrate PHPstorm to use it. But I prefer Sublime.

0 Likes