mirror of
https://github.com/MaskRay/ccls.git
synced 2025-01-19 12:05:50 +00:00
Ignore file name in comparing arguments.
This commit is contained in:
parent
405fd56781
commit
de5e8eeeba
@ -154,10 +154,21 @@ ShouldParse FileNeedsParse(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Command-line arguments changed.
|
// Command-line arguments changed.
|
||||||
if (opt_previous_index && opt_previous_index->args != args) {
|
auto is_file = [](const std::string& arg) {
|
||||||
|
return EndsWithAny(arg, {".h", ".c", ".cc", ".cpp", ".hpp", ".m", ".mm"});
|
||||||
|
};
|
||||||
|
if (opt_previous_index) {
|
||||||
|
auto& prev_args = opt_previous_index->args;
|
||||||
|
bool same = prev_args.size() == args.size();
|
||||||
|
for (size_t i = 0; i < args.size() && same; ++i) {
|
||||||
|
same = prev_args[i] == args[i] ||
|
||||||
|
(is_file(prev_args[i]) && is_file(args[i]));
|
||||||
|
}
|
||||||
|
if (!same) {
|
||||||
LOG_S(INFO) << "Arguments have changed for " << path << unwrap_opt(from);
|
LOG_S(INFO) << "Arguments have changed for " << path << unwrap_opt(from);
|
||||||
return ShouldParse::Yes;
|
return ShouldParse::Yes;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// File has not changed, do not parse it.
|
// File has not changed, do not parse it.
|
||||||
return ShouldParse::No;
|
return ShouldParse::No;
|
||||||
|
Loading…
Reference in New Issue
Block a user