mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-25 00:55:08 +00:00
project: override the compdb entry with .ccls if compile_commands.json is not used
Note: `exact_match` should be false if the entry is an synthetic one, instead of an explicit entry in compile_commands.json
This commit is contained in:
parent
aa4d2d1b43
commit
55c0d5b4eb
@ -522,9 +522,10 @@ Project::Entry Project::findEntry(const std::string &path, bool can_redirect,
|
|||||||
auto it = folder.path2entry_index.find(path);
|
auto it = folder.path2entry_index.find(path);
|
||||||
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;
|
// best->compdb_size is >0 for an explicit compile_commands.json
|
||||||
if ((match = exact_match || can_redirect) || entry.compdb_size) {
|
// entry, 0 for an implicit entry.
|
||||||
// best->compdb_size is >0 for a compdb entry, 0 for a .ccls entry.
|
exact_match = entry.compdb_size > 0 && entry.filename == path;
|
||||||
|
if ((match = exact_match || can_redirect) && entry.compdb_size) {
|
||||||
best_compdb_folder = &folder;
|
best_compdb_folder = &folder;
|
||||||
best = &entry;
|
best = &entry;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user