Reputation: 21005
This is my problem - its unreadable
In order to get .ejs working in general, I've so far added the following. I also have format on save and prettier. I'm looking for proposals to get better formatting of this so that I can read it.
"files.associations": {
"*.ejs": "html",
"*.css": "postcss"
},
"emmet.includeLanguages": {
"postcss": "css",
"ejs": "html"
},
"emmet.syntaxProfiles": {
"postcss": "css",
"ejs": "html"
}
Upvotes: 3
Views: 5300
Reputation: 1661
I know that's an old question, but working with .ejs in VSCode is still a problem. But I found the solution (for ?
delimeter)
EJS language support
plugin<? for( let item of array ) { ?>
(some data)
<? } ?>
are formatted incorrectly (at least with default html formatter).
ejs.delimeter = '?'
. Now you have correct indentation with <? ... ?>
tags.Snippets Ranger
plugin, then find needed extension and edit its file. The Snippets Ranger
is very handy tool.I hope I helped somebody to setup VSCode for .ejs files
Upvotes: 2
Reputation:
I would suggest using EJS language support which is according to them
Syntax highlighting for EJS, Javascript, and HTML tags. Includes javascript autocompletion.
and if you are interested in a Linter you should check out
EJS-Lint which according to them
EJS-Lint parses scriptlet tags (<%, %>, <%_, _%>, and -%>). It ignores all other tags (i.e. <%=).
Note: This linter does not attempt to check for unclosed EJS tags, so if you get an error Unexpected token with a line number that doesn't contain any scriptlets, you most likely forgot to close a tag earlier.
It also is set up to handle old-style includes (<% include filename %>) by ignoring them. It does not lint included files regardless of the method of inclusion.
It can work with custom delimiters, just pass it in the options (if using the API) or pass the --delimiter (-d) flag on the CLI.
Upvotes: 0