mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 07:35:08 +00:00
project: decrease score if .c is matched against .hh (#549)
This commit is contained in:
parent
e373f9ed97
commit
6c87a4656c
@ -551,11 +551,16 @@ Project::Entry Project::findEntry(const std::string &path, bool can_redirect,
|
||||
if (!best) {
|
||||
// Infer args from a similar path.
|
||||
int best_score = INT_MIN;
|
||||
auto [lang, header] = lookupExtension(path);
|
||||
for (auto &[root, folder] : root2folder)
|
||||
if (StringRef(path).startswith(root))
|
||||
for (const Entry &e : folder.entries)
|
||||
if (e.compdb_size) {
|
||||
int score = computeGuessScore(path, e.filename);
|
||||
// Decrease score if .c is matched against .hh
|
||||
auto [lang1, header1] = lookupExtension(e.filename);
|
||||
if (lang != lang1 && !(lang == LanguageId::C && header))
|
||||
score -= 30;
|
||||
if (score > best_score) {
|
||||
best_score = score;
|
||||
best_compdb_folder = &folder;
|
||||
|
Loading…
Reference in New Issue
Block a user