Skip to content

Commit e377555

Browse files
committed
Automatically restart clangd language server after it is installed
1 parent 71a7b31 commit e377555

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/install.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,12 @@ class UI {
8181
}
8282
}
8383

84+
private _pathUpdated: Promise<void>|null = null;
85+
8486
async promptReload(message: string) {
85-
if (await vscode.window.showInformationMessage(message, 'Reload window'))
86-
vscode.commands.executeCommand('workbench.action.reloadWindow');
87+
await this._pathUpdated;
88+
this._pathUpdated = null;
89+
vscode.commands.executeCommand('clangd.restart');
8790
}
8891

8992
async showHelp(message: string, url: string) {
@@ -129,6 +132,8 @@ class UI {
129132
return p;
130133
}
131134
set clangdPath(p: string) {
132-
config.update('path', p, vscode.ConfigurationTarget.Global);
135+
this._pathUpdated = new Promise(resolve => {
136+
config.update('path', p, vscode.ConfigurationTarget.Global).then(resolve);
137+
});
133138
}
134139
}

0 commit comments

Comments
 (0)