Repository navigation
Add embedded language syntax highlighting support - #1180
angelozerr wants to merge 1 commit into
Conversation
Add xml.embeddedLanguages setting and TextMate grammar resolution for embedded language syntax highlighting in XML files. - Add xml.embeddedLanguages setting with DocumentMatcher + expressions - Add xml.textMateGrammar command to resolve grammar paths from installed VS Code extensions (e.g., built-in Groovy, Java, SQL) - Add settings enrichment to inject grammarPath before sending to lemminx - Expressions use xpath + languageId; grammarPath resolved automatically - Add documentation for embedded languages and semantic tokens features Signed-off-by: azerr <azerr@redhat.com>
|
Hi Angelo, a few small things about the doc:
|
|
Thanks @MeherSru To be honest with you, it is just a POC. Thanks for your feedback, I need to check your feedback. |
|
Tried it out with a fake xhtml document. I used this for my settings: "xml.embeddedLanguages": [
{
"pattern": "**/*.xml",
"expressions": [
{
"languageId": "javascript",
"xpath": "/html/script/text()"
}
]
}
]I get the highlighting, but noticed that the colours are different from a standard JavaScript file. I think this is because semantic token colours are highlighted differently than their regular TextMate scope counterparts. I don't think there's much we can do about this, since we can only set the token type and don't have control over what the theme chooses to colour those tokens.
|
I will fix that
Indeed I need to declare it in package.json
Let me check that, but it will not possible I think to have exactly the same result from vscode texmate and LSP semantic highlighting
Yes it is normal, required element/attr comes from XML grammar. I will create a new PR about this LSP semantic support. |
I think so. I know it is not perfect but I think it is nice to have syntax coloration. I will mention this limitation in the doc. |


This PR requires eclipse-lemminx/lemminx#1881
Add xml.embeddedLanguages setting and TextMate grammar resolution for embedded language syntax highlighting in XML files.