我正在通过转换Sublime tmBundle为VS Code开发语言支持扩展。我正在使用siteleaf/liquid-syntax-mode的捆绑包。我使用$this->zip->add_dir('myfolder'); // Creates a directory called "myfolder"
选项4&成功地包含了以下内容5并结合输出:
yo code
).tmLanguage
)我想要做的是通过直接导入.sublime-snippet
文件或以某种方式重写它来添加自动完成/智能感知支持。
甚至可以在VS Code中的自动完成/智能感知中添加项目吗?
答案 0 :(得分:0)
如果我创建一个Language Server扩展名,看起来是可能的。来自网站:
语言服务器通常实现的第一个有趣功能是文档验证。从这个意义上说,即使是一个linter也算作语言服务器,而在VS Code中,linters通常被实现为语言服务器(例如,参见eslint和jshint)。但语言服务器还有很多。他们可以提供完整的代码,查找所有引用或转到定义。下面的示例代码将代码完成添加到服务器。它只是提出两个单词' TypeScript'和' JavaScript'。
一些示例代码:
// This handler provides the initial list of the completion items.
connection.onCompletion((textDocumentPosition: TextDocumentPositionParams): CompletionItem[] => {
// The pass parameter contains the position of the text document in
// which code complete got requested. For the example we ignore this
// info and always provide the same completion items.
return [
{
label: 'TypeScript',
kind: CompletionItemKind.Text,
data: 1
},
{
label: 'JavaScript',
kind: CompletionItemKind.Text,
data: 2
}
]
});
// This handler resolve additional information for the item selected in
// the completion list.
connection.onCompletionResolve((item: CompletionItem): CompletionItem => {
if (item.data === 1) {
item.detail = 'TypeScript details',
item.documentation = 'TypeScript documentation'
} else if (item.data === 2) {
item.detail = 'JavaScript details',
item.documentation = 'JavaScript documentation'
}
return item;
});