samholmes / EJS.tmLanguage

An EJS syntax definition specifically for sublime text
47 stars 28 forks source link

Errors in latest Sublime Update #16

Open shennan opened 8 years ago

shennan commented 8 years ago

Since I updated Sublime with the auto updater, this package has started to throw errors in valid markup.

screen shot 2016-02-11 at 01 39 03

Sublime Version: Stable Channel, Build 3103

busheezy commented 8 years ago

Yeah, I'm dealing with huge pink lines as well.

shennan commented 8 years ago

Another example of the syntax highlighter breaking: for loops.

screen shot 2016-02-22 at 10 25 44
szanata commented 8 years ago

I'm having this errors too =/

0bserver07 commented 8 years ago

Same here, any suggestions where to start debugging this?

Cherna commented 8 years ago

Same problem here. In my case I found this is the issue:

// This works since there's no open brackets or parentheses.
<% arr.forEach(function(item) { })%> 

// This messes up all the html inside the block.
<% arr.forEach(function(item) { %> 

Hope this helps debug, the lack of correct syntax highlighting is driving me crazy.

Edit: This is the same issue as in #14 .

nwoltman commented 8 years ago

I believe these problems are solved in the EJS 2 package that I wrote. I hope it's okay that it requires the Babel package (I needed it to support ES6).

mattrat commented 8 years ago

I was having the same issue. So I removed the EJS package:

Then I installed Babel

Then I installed EJS 2 (same as babel)

Fixed! Thanks @nwoltman, this only took a couple minutes.

nwoltman commented 8 years ago

Glad to hear it @mattrat :smiley:

samholmes commented 6 years ago

@nwoltman how did you solve this issue with your package (EJS 2)? Is the issue inherent in the fact that I’m still using a tmLanguage file instead of a sublime-syntax file?

nwoltman commented 6 years ago

@samholmes I'm not very familiar with tmLanguage files so I can't say for sure, but I think it should still be possible to solve as long as it lets you sort of "import" an existing syntax.

My solution was essentially these three steps:

  1. Start the syntax as HTML (using the built-in HTML syntax)
  2. If an EJS opening brace (<%) is encountered, make JavaScript the syntax (using a clone of the Babel-JavaScript syntax file)
  3. If an EJS closing brace (%>) is encountered, go back to HTML

Here's the file that has this logic: https://github.com/nwoltman/sublime-ejs/blob/master/EJS.sublime-syntax