Custom syntax highlights inside template tag

Is it possible to have custom syntax hightlight for different tags? 
Like in HTML (code inside <script> is javascript, code inside <style> is css). But is it possible to implete some custom scenario?
<can-component tag='can-tabs'>
  <style type='less'>
         margin-top: 20px;
     button {clear: both;}
     ul {
         padding: 0px; margin: 0px;
     }
  .... here goes less css syntax highlight
  </style>
  <template type='text/stache'>
    <ul>
      {{#panels}}
        <li {{#isActive}}class='active'{{/isActive}}
             can-click='makeActive'>
                {{title}}
         </li>
      {{/panels}}
    </ul>
    <content></content>
  .... here goes mustache syntax highlight
  </template>
  <scope>
    import can from "can";
    import "can-panel.stache!"
    
   here goes javascript syntax highlight
  </scope>
  <events>
     export default {}
    here goes javascript syntax highlight
  </events>
  <helpers>
     export default {}
  here goes javascript syntax highlight
  </helpers>
</can-component>
0
2 comments

You can use language injections (https://www.jetbrains.com/webstorm/help/using-language-injections.html) to inject javascript in certain tags. These can be either temporary injections, created via Alt+Enter, Inject language/reference, or custom injections defined in Settings | Editor | Language Injections.

Mustache, however, can't be injected. It is not an injectable language, it's a templating language that can only be used as a 'master' language for other languages. If you miss a possibility to  inject template languages, please follow https://youtrack.jetbrains.com/issue/IDEA-106449 for updates

0

Thanks!

0

Please sign in to leave a comment.