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