mirror of
https://github.com/MaskRay/ccls.git
synced 2025-06-07 08:44:55 +00:00
project: override the compdb entry with .ccls if compile_commands.json is not used
This commit is contained in:
parent
0b5372ddf2
commit
ef8473ecc0
@ -523,7 +523,7 @@ Project::Entry Project::findEntry(const std::string &path, bool can_redirect,
|
|||||||
if (it != folder.path2entry_index.end()) {
|
if (it != folder.path2entry_index.end()) {
|
||||||
Project::Entry &entry = folder.entries[it->second];
|
Project::Entry &entry = folder.entries[it->second];
|
||||||
exact_match = entry.filename == path;
|
exact_match = entry.filename == path;
|
||||||
if ((match = exact_match || can_redirect) || entry.compdb_size) {
|
if ((match = exact_match || can_redirect) && entry.compdb_size) {
|
||||||
// best->compdb_size is >0 for a compdb entry, 0 for a .ccls entry.
|
// best->compdb_size is >0 for a compdb entry, 0 for a .ccls entry.
|
||||||
best_compdb_folder = &folder;
|
best_compdb_folder = &folder;
|
||||||
best = &entry;
|
best = &entry;
|
||||||
@ -533,8 +533,9 @@ Project::Entry Project::findEntry(const std::string &path, bool can_redirect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool append = false;
|
bool append = false;
|
||||||
if (best_dot_ccls_args && !(append = appendToCDB(*best_dot_ccls_args)) &&
|
if (best_dot_ccls_args &&
|
||||||
!exact_match) {
|
(!best_compdb_folder ||
|
||||||
|
(!(append = appendToCDB(*best_dot_ccls_args)) && !exact_match))) {
|
||||||
// If the first line is not %compile_commands.json, override the compdb
|
// If the first line is not %compile_commands.json, override the compdb
|
||||||
// match if it is not an exact match.
|
// match if it is not an exact match.
|
||||||
ret.root = ret.directory = best_dot_ccls_root;
|
ret.root = ret.directory = best_dot_ccls_root;
|
||||||
|
Loading…
Reference in New Issue
Block a user