问题
I have downloaded a plugin for Language A. It is at %USERPROFILE%.vscode\extensions\langA\syntaxes. There is a file langA.tmLanguage. It is XML.
I am creating "language B". I have a JSON tmLanguage file. I have already added some custom coloring and folding rules. I would like to inherit language A's syntax when it is embedded in Language B between START_MARKER and END_MARKER. Is this possible? Can someone help with the JSON syntax to accomplish this?
Bonus Q: Can anyone point me to a real simple hover example not using a language server? I would like to create a hover that takes the word with the cursor and searches the document for "DEF_MARKER word" to display in the hover. I am struggling with the real language examples due to my lack of experience in these languages and the complexity involved in say the GO example or other plugins I have downloaded.
回答1:
I think I got it.
{
"name": "entity.name.tag",
"begin": "^START_MARKER",
"end": "^END_MARKER",
"patterns": [
{
"include": "source.LangA"
}
]
}
来源:https://stackoverflow.com/questions/47394392/visual-studio-code-how-to-include-another-language-in-a-user-defined-language