mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-25 17:11:59 +00:00
Small code cleanup
This commit is contained in:
parent
b258f2dd0b
commit
440c6c5325
@ -83,6 +83,11 @@ struct CodeCompleteCache {
|
|||||||
optional<lsPosition> cached_completion_position;
|
optional<lsPosition> cached_completion_position;
|
||||||
NonElidedVector<lsCompletionItem> cached_results;
|
NonElidedVector<lsCompletionItem> cached_results;
|
||||||
NonElidedVector<lsDiagnostic> cached_diagnostics;
|
NonElidedVector<lsDiagnostic> cached_diagnostics;
|
||||||
|
|
||||||
|
bool IsCacheValid(lsTextDocumentPositionParams position) const {
|
||||||
|
return cached_path == position.textDocument.uri.GetPath() &&
|
||||||
|
cached_completion_position == position.position;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1735,8 +1740,7 @@ bool QueryDbMainLoop(
|
|||||||
delete message;
|
delete message;
|
||||||
}, message.release(), std::placeholders::_1, std::placeholders::_2);
|
}, message.release(), std::placeholders::_1, std::placeholders::_2);
|
||||||
|
|
||||||
if (code_complete_cache->cached_path == params.textDocument.uri.GetPath() &&
|
if (code_complete_cache->IsCacheValid(params)) {
|
||||||
code_complete_cache->cached_completion_position == params.position) {
|
|
||||||
std::cerr << "[complete] Using cached completion results at " << params.position.ToString() << std::endl;
|
std::cerr << "[complete] Using cached completion results at " << params.position.ToString() << std::endl;
|
||||||
callback(code_complete_cache->cached_results, code_complete_cache->cached_diagnostics);
|
callback(code_complete_cache->cached_results, code_complete_cache->cached_diagnostics);
|
||||||
}
|
}
|
||||||
@ -1810,8 +1814,7 @@ bool QueryDbMainLoop(
|
|||||||
delete message;
|
delete message;
|
||||||
}, message.release(), search, active_param, std::placeholders::_1);
|
}, message.release(), search, active_param, std::placeholders::_1);
|
||||||
|
|
||||||
if (signature_cache->cached_path == params.textDocument.uri.GetPath() &&
|
if (signature_cache->IsCacheValid(params)) {
|
||||||
signature_cache->cached_completion_position == params.position) {
|
|
||||||
std::cerr << "[complete] Using cached completion results at " << params.position.ToString() << std::endl;
|
std::cerr << "[complete] Using cached completion results at " << params.position.ToString() << std::endl;
|
||||||
callback(signature_cache->cached_results, signature_cache->cached_diagnostics);
|
callback(signature_cache->cached_results, signature_cache->cached_diagnostics);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user