问题描述
我正在开发 VSCode 扩展.当我更改其源时,是否可以自动重新加载扩展程序.目前,我需要按 + + .
I'm developing a VSCode extension. Is it possible to automatically have the extension reloaded when I change its source. Currently, I need to press + + .
推荐答案
我猜你的扩展是用 TS/javascript 编写的,所以你可以使用 fs.watch 观看您的源代码,并找到运行 vscode 命令 workbench.action.reloadWindow
的方法,它是来自 vscode 来源,函数ReloadWindowAction.Run()
或直接windowService.reloadWindow()
.
I guess your extension is written in TS/javascript, so you can use fs.watch to watch your sources, and find a way to run the vscode command workbench.action.reloadWindow
, which isfrom sources of vscode, the function ReloadWindowAction.Run()
or directly windowService.reloadWindow()
.
export class ReloadWindowAction extends Action {
static readonly ID = 'workbench.action.reloadWindow';
static LABEL = nls.localize('reloadWindow', "Reload Window");
constructor(
id: string,
label: string,
@IWindowService private windowService: IWindowService
) {
super(id, label);
}
run(): TPromise<boolean> {
return this.windowService.reloadWindow().then(() => true);
}
}
它可能是连接这些功能的一个小扩展.
It might be a tiny extension that connect those functions.
这篇关于VSCode:当扩展源发生变化时自动重启扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!