Locate the html extension in the VSCode extensions folder:
../app/extensions/html
what's on macOS x
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/html
and on Windows -
c:\Program Files(x86)\Microsoft VS Code\resources\app\extensions\html\package.json
Now edit the package.json file by adding the .ejs extensions array:
{ "name": "html", "version": "0.1.0", "publisher": "vscode", "engines": { "vscode": "*" }, "contributes": { "languages": [{ "id": "html", "extensions": [ ".html", ".htm", ".shtml", ".mdoc", ".jsp", ".asp", ".aspx", ".jshtm", ".ejs" ], "aliases": [ "HTML", "htm", "html", "xhtml" ], "mimetypes": ["text/html", "text/x-jshtm", "text/template", "text/ng-template"] }], "grammars": [{ /* "language": "html", not yet enabled*/ "scopeName": "text.html.basic", "path": "./syntaxes/HTML.plist" }] } }
By the way, the correct way should be to create an ejs extension in the extensions folder, and then add:
ejs/ ejs/package.json ejs/snippet/ ejs/snippet/ejs.json ejs/syntaxes/ ejs/syntaxes/EJS.plist
Of course, this should have EJS syntax / grammar, but we can just duplicate the html file, so from the extensions folder:
cd html/ cp -r * ../ejs/
package.json then could be like
{ "name": "ejs", "version": "0.1.0", "publisher": "vscode", "engines": { "vscode": "*" }, "contributes": { "languages": [{ "id": "ejs", "extensions": [ ".ejs" ], "aliases": [ "EJS", "ejs" ], "mimetypes": ["text/html", "text/x-jshtm", "text/template", "text/ng-template"] }], "grammars": [{ "scopeName": "text.html.basic", "path": "./syntaxes/EJS.plist" }] } }
change syntaxes/HTML.plist only to syntaxes/EJS.plist .
Then restart VSCode.