问题描述
我已经下载了语言A的插件.它位于%USERPROFILE%.vscode \ extensions \ langA \ syntaxes.有一个文件langA.tmLanguage.是XML.
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.
我正在创建语言B".我有一个JSON tmLanguage文件.我已经添加了一些自定义的着色和折叠规则.当语言A嵌入在START_MARKER和END_MARKER之间的语言B中时,我想继承它的语法.这可能吗?有人可以帮助JSON语法吗?
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?
奖金问:有人能指出我一个不使用语言服务器的简单悬浮示例吗?我想创建一个悬停,将光标放在单词上,然后在文档中搜索"DEF_MARKER单词"以显示在悬停中.由于我缺乏对这些语言的经验,而且我说的GO例子或我下载的其他插件涉及到复杂性,因此我在实际的语言例子中苦苦挣扎.
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.
推荐答案
我想我明白了.
{
"name": "entity.name.tag",
"begin": "^START_MARKER",
"end": "^END_MARKER",
"patterns": [
{
"include": "source.LangA"
}
]
}
这篇关于Visual Studio代码:如何在用户定义的语言中包括另一种语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!