Skip to content

Commit

Permalink
Add a maxRestartCount option
Browse files Browse the repository at this point in the history
Allowing us to control the maximum clangd restart times (by default it is 4), this
would make the life of tracking/reporting crashes a bit easier.
  • Loading branch information
hokein committed Nov 24, 2020
1 parent c9bbefc commit 96bc005
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@
"default": true,
"description": "Always rank completion items on the server as you type. This produces more accurate results at the cost of higher latency than client-side filtering."
},
"clangd.maxRestartCount": {
"type": "number",
"default": 4,
"description": "The maximum count that the extension will restart clangd if clangd crashes."
},
"clangd.checkUpdates": {
"type": "boolean",
"default": false,
Expand Down
3 changes: 3 additions & 0 deletions src/clangd-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ export class ClangdContext implements vscode.Disposable {

this.client = new ClangdLanguageClient('Clang Language Server',
serverOptions, clientOptions);
this.client.clientOptions.errorHandler =
this.client.createDefaultErrorHandler(
config.get<number>('maxRestartCount'));
if (config.get<boolean>('semanticHighlighting'))
semanticHighlighting.activate(this);
this.client.registerFeature(new EnableEditsNearCursorFeature);
Expand Down

0 comments on commit 96bc005

Please sign in to comment.