Turbo87 / intellij-emberjs

Ember.js support for JetBrains IDEs (IntelliJ, WebStorm, ...)
Apache License 2.0
218 stars 33 forks source link

Add support for HTML elements starting with `@` #208

Open Turbo87 opened 6 years ago

Turbo87 commented 6 years ago

Right now the HTML parser in IntelliJ will throw up on HTML elements starting with @, but the following will soon be possible in Ember.js:

<@navbar.Item>Foo</@navbar.Item>
Turbo87 commented 6 years ago

@denofevil sent me the following instructions via email:


According to the HTML spec (https://www.w3.org/TR/html52/syntax.html#tokenizer-tag-open-state) that is not a valid tag name. Due to this I’d rather avoid adding this change to the HTML lexer.

What I’d suggest instead is to make a copy of https://github.com/JetBrains/intellij-community/blob/master/xml/xml-psi-impl/src/com/intellij/lexer/_HtmlLexer.flex with required edits, making a new language with its own parser definition (e.g. https://github.com/JetBrains/intellij-plugins/blob/master/vuejs/src/org/jetbrains/vuejs/VueLanguage.kt & https://github.com/JetBrains/intellij-plugins/blob/master/vuejs/src/org/jetbrains/vuejs/language/VueParserDefinition.kt#L34 & https://github.com/JetBrains/intellij-plugins/blob/master/vuejs/src/org/jetbrains/vuejs/language/VueSyntaxHighlighterFactory.kt#L15). You can then substitute HTML for this language via LanguageSubstitutor (https://github.com/JetBrains/intellij-plugins/blob/master/handlebars/src/com/dmarcotte/handlebars/file/HbLanguageSubstitutor.java) for Ember projects