【发布时间】:2017-09-27 10:58:48
【问题描述】:
对于一个长时间运行的进程,我想在 Visual Studio Code 中显示一个繁忙的指示器。有类似 typescript 扩展使用的东西就足够了:
但是,使用正常的状态栏项目无法按预期工作。我什至无法在开始操作之前显示该项目,因为它似乎需要将控制权返回给 vscode。
我试过的是这样的:
...
busyIndicator = window.createStatusBarItem(StatusBarAlignment.Left, 1000);
busyIndicator.text = "##";
busyIndicator.show();
...
workspace.onDidSaveTextDocument((doc: TextDocument) => {
if (doc.languageId === "antlr") {
//busyIndicator.show();
busyIndicator.text = "X";
let tempPath = Utils.createTempFolder();
let result = backend.generate(doc.fileName, { outputDir: tempPath, listeners: false, visitors: false });
Utils.deleteFolderRecursive(tempPath);
//busyIndicator.hide();
busyIndicator.text = "Y";
}
});
值 X 永远不会显示,并且在操作结束时出现 Y(如预期的那样)。如果连简单的文本更新都不起作用,我怎么能显示动画?
【问题讨论】:
-
现在看到code.visualstudio.com/updates/… 不是状态栏而是通知。
标签: typescript visual-studio-code vscode-extensions