I want my .ejs files to have html syntax, however, it always opens the files as Plain Text.
In sublime you can choose "Open all with current extension as..." then choose your syntax.
I see that you can change the syntax in the left bottom corner
How do you open files with a certain type with a specific syntax?
If your language really is just HTML, you can set up a simple package to handle this.
Create a package called langugage-ejs
and in grammars/ejs.cson
you can include HTML as having the patterns you care about:
'fileTypes': [
'ejs'
]
'name': 'Embedded JavaScript'
'patterns': [
{
'include': 'source.html'
}
]
'scopeName': 'source.ejs'
language-ipynb certainly does this by extending JSON.
In reality though, you have template tags on top of HTML that you would want to make the editor recognize. The best example I can find is for erb (Embedded Ruby templates). It sources from HTML but also adds on other tags as shown in this snippet:
...
'patterns': [
{
'begin': '<%+#'
'captures':
'0':
'name': 'punctuation.definition.comment.erb'
'end': '%>'
'name': 'comment.block.erb'
}
{
'begin': '<%+(?!>)[-=]?'
'captures':
'0':
'name': 'punctuation.section.embedded.ruby'
'end': '-?%>'
'name': 'source.ruby.rails.embedded.html'
'patterns': [
{
'captures':
'1':
'name': 'punctuation.definition.comment.ruby'
'match': '(#).*?(?=-?%>)'
'name': 'comment.line.number-sign.ruby'
}
{
'include': 'source.ruby.rails'
}
]
}
{
'include': 'text.html.basic'
}
]
...