ccls/src/code_complete_cache.cc
Jacob Dufault 3599a831b1 Introduce MessageHandler abstraction. Mainly just code reorg.
Only the initialize request uses it so far, but this will enable pulling
quite a bit of code out of command_line.cc.
2017-12-04 23:57:41 -08:00

12 lines
404 B
C++

#include "code_complete_cache.h"
void CodeCompleteCache::WithLock(std::function<void()> action) {
std::lock_guard<std::mutex> lock(mutex_);
action();
}
bool CodeCompleteCache::IsCacheValid(lsTextDocumentPositionParams position) {
std::lock_guard<std::mutex> lock(mutex_);
return cached_path_ == position.textDocument.uri.GetPath() &&
cached_completion_position_ == position.position;
}