Skip to content

Commit

Permalink
cpp: Watch changes to compile_commands.json
Browse files Browse the repository at this point in the history
This patch makes it so we watch any file called compile_commands.json
and we forward the change notifications to the language server.  clangd
will use this to see if the compilation flags of some cpp files have
changed, and therefore if re-parse/re-indexing is necessary.

Signed-off-by: Simon Marchi <[email protected]>
  • Loading branch information
Simon Marchi authored and simark committed Jul 19, 2018
1 parent 6eb5fda commit 042a4c6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/cpp/src/browser/cpp-language-client-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,17 @@ export class CppLanguageClientContribution extends BaseLanguageClientContributio
}

protected get documentSelector() {
// This is used (at least) to determine which files, when they are open,
// trigger the launch of the C/C++ language server.
return HEADER_AND_SOURCE_FILE_EXTENSIONS;
}

protected get globPatterns() {
// This is used (at least) to determine which files we watch. Change
// notifications are forwarded to the language server.
return [
'**/*.{' + HEADER_AND_SOURCE_FILE_EXTENSIONS.join() + '}'
'**/*.{' + HEADER_AND_SOURCE_FILE_EXTENSIONS.join() + '}',
'**/compile_commands.json',
];
}

Expand Down

0 comments on commit 042a4c6

Please sign in to comment.