diff --git a/src/install.ts b/src/install.ts index b333c40..fa41a99 100644 --- a/src/install.ts +++ b/src/install.ts @@ -81,9 +81,13 @@ class UI { } } + private _pathUpdated: Promise|null = null; + async promptReload(message: string) { - if (await vscode.window.showInformationMessage(message, 'Reload window')) - vscode.commands.executeCommand('workbench.action.reloadWindow'); + vscode.window.showInformationMessage(message); + await this._pathUpdated; + this._pathUpdated = null; + vscode.commands.executeCommand('clangd.restart'); } async showHelp(message: string, url: string) { @@ -129,6 +133,8 @@ class UI { return p; } set clangdPath(p: string) { - config.update('path', p, vscode.ConfigurationTarget.Global); + this._pathUpdated = new Promise(resolve => { + config.update('path', p, vscode.ConfigurationTarget.Global).then(resolve); + }); } }