mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-26 17:41:58 +00:00
3599a831b1
Only the initialize request uses it so far, but this will enable pulling quite a bit of code out of command_line.cc.
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;
|
|
} |