admin管理员组文章数量:1332872
User can achieve this by running 'Reload Window' available via editor's 'Command Palette'. That however from an extension authoring point of view is not as straight forward as prompting the user right away.
Desired oute is to take current implementation in this pull request from [screenshot]
to [screenshot]
.
User can achieve this by running 'Reload Window' available via editor's 'Command Palette'. That however from an extension authoring point of view is not as straight forward as prompting the user right away.
Desired oute is to take current implementation in this pull request from [screenshot]
to [screenshot]
.
Share Improve this question asked Nov 5, 2017 at 20:01 FelicioFelicio 5055 silver badges15 bronze badges2 Answers
Reset to default 5Once you prompt the user to confirm using vscode.window.showInformationMessage(...)
to confirm, you can run vscode.mands.executeCommand("workbench.action.reloadWindow")
to reload the window.
Accepted answer posted by user ajshort was crucial to figuring out how to call arbitrary editor mands, however, tying it together with user action still wasn't clear to me.
See function bellow for resolving the user action (click).
/** Prompts user to reload editor window in order for configuration change to take effect. */
function promptToReloadWindow() {
const action = 'Reload';
vscode.window
.showInformationMessage(
`Reload window in order for change in extension \`${EXTENSION_ID}\` configuration to take effect.`,
action
)
.then(selectedAction => {
if (selectedAction === action) {
vscode.mands.executeCommand('workbench.action.reloadWindow');
}
});
}
本文标签: javascriptHow to programmatically reload Visual Studio Code windowStack Overflow
版权声明:本文标题:javascript - How to programmatically reload Visual Studio Code window? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742314615a2451564.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论