Skip to content

Commit

Permalink
trigger workspace/didChangeConfiguration on compilation database modi…
Browse files Browse the repository at this point in the history
…fication
  • Loading branch information
BenjaminNavarro committed Oct 15, 2019
1 parent c144a58 commit 75c2916
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,11 @@
"default": 15,
"description": "Number of lines of the initializer / macro definition showed in hover."
},
"ccls.index.reloadDatabaseOnChange": {
"type": "boolean",
"default": true,
"description": "Reload the compilation database when it is modified."
},
"ccls.codeLens.renderInline": {
"type": "boolean",
"default": false,
Expand Down
8 changes: 8 additions & 0 deletions src/serverContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,14 @@ export class ServerContext implements Disposable {
}

this._dispose.push(commands.registerCommand("ccls.reload", this.reloadIndex, this));

if(config.get("index.reloadDatabaseOnChange", true)) {
const db_watcher = workspace.createFileSystemWatcher(this.cwd + "/compile_commands.json", false, false, false);
this._dispose.push(db_watcher);
db_watcher.onDidChange((e: Uri) => {
this.client.sendNotification("workspace/didChangeConfiguration");
});
}
}

public async stop() {
Expand Down

0 comments on commit 75c2916

Please sign in to comment.