I have the same error - The ejs file is wrongly vetically indented. I applyed the above answers but it could not solved it.
I installed DigitalBrainstem's EJS extension but I think it is useful only to provide snippets.
When selecting Html > format templating > honor django, erb... ejs code collapses to left, like below:
<% array.forEach(function(val, index) { %>
<a href=<%=val.url %>><%= val.name %></a>
<% if (index < book.genre.length - 1) { %>
<%= , %>
<% } %>
<% }) %>
unselected, it looks like a ladder.
This is my settings.json file:
{
"workbench.colorTheme": "Darcula",
"editor.formatOnSave": true,
"liveServer.settings.donotShowInfoMsg": true,
"workbench.iconTheme": "vscode-great-icons",
"workbench.editor.enablePreview": false,
"workbench.editorAssociations": {
"*.svg": "default"
},
"editor.minimap.enabled": false,
"workbench.settings.applyToAllProfiles": [],
"emmet.includeLanguages": {
"*.ejs": "html"
},
"files.associations": {
"*.ejs": "html"
},
}
I would thankfully appreciate any help.