Skip to content

Commit

Permalink
Automatically restart clangd language server after it is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
k0zmo committed Dec 17, 2024
1 parent 71a7b31 commit add1a70
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ class UI {
}
}

private _pathUpdated: Promise<void>|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) {
Expand Down Expand Up @@ -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);
});
}
}

0 comments on commit add1a70

Please sign in to comment.