How to embed language for xml tag?
已回答
I am maintaining a plug-in. One of the functions is to provide editing of the wxml file. This file is very similar to the xml file and contains many unique tags, but does not include the tags that come with html. I am currently looking for a way to embed js language in xml tags.
<wxs>
let a = 1;
class A {
}
class B {
}
</wxs>
请先登录再写评论。
You should implement the <multiHostInjector> extension point to inject another language within the XML file. From JavaDocs:
Check the MultiHostInjector.java for more details.
Thanks you for your reply.
I use <multiHostInjector> solved this, But I have a question, in HtmlLexer, Why Html's <script> and <style> are implemented at the Lexer level
I guess because of the performance. In case you're not providing full language support but extending the existing one - it's required to go with injectors.