EJS.tmLanguage
EJS.tmLanguage copied to clipboard
Errors in latest Sublime Update
Since I updated Sublime with the auto updater, this package has started to throw errors in valid markup.

Sublime Version: Stable Channel, Build 3103
Yeah, I'm dealing with huge pink lines as well.
Another example of the syntax highlighter breaking: for loops.

I'm having this errors too =/
Same here, any suggestions where to start debugging this?
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 .
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).
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.
Glad to hear it @mattrat :smiley:
@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 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:
- Start the syntax as HTML (using the built-in HTML syntax)
- If an EJS opening brace (
<%
) is encountered, make JavaScript the syntax (using a clone of the Babel-JavaScript syntax file) - 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