Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .EJS support or extend existing HTML to include .EJS #2853

Closed
Thomastasa opened this issue Feb 9, 2016 · 2 comments
Closed

Add .EJS support or extend existing HTML to include .EJS #2853

Thomastasa opened this issue Feb 9, 2016 · 2 comments
Assignees

Comments

@Thomastasa
Copy link

Feature Request: .EJS support

Can you please add EJS support or extend the existing HTML to include .EJS files? I know it takes time to do the custom syntax highlighting, but in the meantime can you at least have .EJS files open with the .HTML template?

Below is my current fix, for anyone interested. It has to be re-applied after each version update, which is why i am asking if you could just add .EJS to the list of extensions/aliases for HTML.

VSCODE_DIR:
win:
c:\Program Files(x86)\Microsoft VS Code
mac:
Applications > Visual Studio Code.app > right click > show package content

open VSCODE_DIR\resources\app\extensions\html\package.json and add ".ejs" to extensions array and add "ejs" to aliases array.

here is a copy of how my package.json file looks after the change (on version 0.10.8 - older versions use a different file scheme):

{
    "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", "ejs" ],
            "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"
        }]
    }
}

Here are the docs for .EJS which shows default syntax incase you ever add syntax support for EJS:
http://www.embeddedjs.com/

@aeschli aeschli modified the milestones: March 2016, Backlog Mar 7, 2016
@aeschli
Copy link
Contributor

aeschli commented Mar 7, 2016

In the March release we have user definable file association (see #3612). So you will be able to associate EJS files to the html language mode.
Adding ejs to the html languages contribution point by default is IMO not a good idea as, if I understand correctly, EJS files are not always valid HTML files.

@aeschli aeschli closed this as completed Mar 7, 2016
@iongion
Copy link

iongion commented May 17, 2016

What about this use case ?

(function(scope){
  var configuration = <%- JSON.stringify() %>;
  scope.RUNTIME_CONFIGURATION = configuration;
})(this);

Where the file gets saved as configuration.js.jst

This is not html, it is javascript with ejs embeded inside, so an EJS mode still is a nice to have

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants