mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-26 17:41:58 +00:00
12 lines
404 B
C++
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;
|
||
|
}
|