编写VSCode扩展:如何检查现有的代码段定义?

问题描述

我正在写我的第一个VS Code扩展。我希望它用片段来做一些花哨的事情。 (我是在Sublime中使用摘要的老手。)

我在VS Code扩展api文档中看到了如何在我提供摘录文本的地方插入和执行摘录:

let snippet: SnippetString = "template text here";
window.activeTextEditor.insertSnippet(snippet);

我还看到了如何执行通过其前缀调用先前配置的代码段的命令:

vscode.commands.executeCommand("type","pfix");
vscode.commands.executeCommand("insertSnippet");

但是,我看不到的是如何以编程方式检查先前配置的代码段的文本。 我希望能够做到这一点:

snippet = somehowLookupExistingSnippetByPrefix("pfix");
(possibly adjust the snippet text here)
window.activetextEditor.insertSnippet(snippet);

我是否缺少未记录(或记录模糊)的API调用?或者,是否有一种蛮力获取配置信息的方法

谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)