Skip to content

Commit 4a6319a

Browse files
authored
Automatically restart clangd language server after it is installed (#749)
1 parent 71a7b31 commit 4a6319a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/install.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,13 @@ 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+
vscode.window.showInformationMessage(message);
88+
await this._pathUpdated;
89+
this._pathUpdated = null;
90+
vscode.commands.executeCommand('clangd.restart');
8791
}
8892

8993
async showHelp(message: string, url: string) {
@@ -129,6 +133,8 @@ class UI {
129133
return p;
130134
}
131135
set clangdPath(p: string) {
132-
config.update('path', p, vscode.ConfigurationTarget.Global);
136+
this._pathUpdated = new Promise(resolve => {
137+
config.update('path', p, vscode.ConfigurationTarget.Global).then(resolve);
138+
});
133139
}
134140
}

0 commit comments

Comments
 (0)