EJS.tmLanguage icon indicating copy to clipboard operation
EJS.tmLanguage copied to clipboard

Errors in latest Sublime Update

Open shennan opened this issue 9 years ago • 10 comments

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

shennan avatar Feb 11 '16 01:02 shennan

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

busheezy avatar Feb 21 '16 00:02 busheezy

Another example of the syntax highlighter breaking: for loops.

screen shot 2016-02-22 at 10 25 44

shennan avatar Feb 22 '16 10:02 shennan

I'm having this errors too =/

szanata avatar Feb 25 '16 22:02 szanata

Same here, any suggestions where to start debugging this?

0bserver07 avatar Feb 27 '16 18:02 0bserver07

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 .

Cherna avatar Feb 29 '16 17:02 Cherna

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).

nwoltman avatar May 07 '16 06:05 nwoltman

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

  • Press control+shift+p
  • Type remove
  • Go down to Package Control: Remove Package
  • Press Enter
  • Type ejs
  • Go down to EJS
  • Press Enter

Then I installed Babel

  • Press control+shift+p
  • Type install
  • Go down to Package Control: Install Package
  • Press Enter
  • wait ...
  • Type babel
  • Go down to Babel
  • Press Enter

Then I installed EJS 2 (same as babel)

  • Press control+shift+p
  • Type install
  • Go down to Package Control: Install Package
  • Press Enter
  • wait ...
  • Type ejs
  • Go down to EJS 2
  • Press Enter

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

mattrat avatar May 12 '16 14:05 mattrat

Glad to hear it @mattrat :smiley:

nwoltman avatar May 12 '16 17:05 nwoltman

@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?

samholmes avatar May 01 '18 06:05 samholmes

@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

nwoltman avatar May 01 '18 15:05 nwoltman