mirror of
https://github.com/MaskRay/ccls.git
synced 2025-01-31 18:00:26 +00:00
c68548a2ca
% time clang++ -fsyntax-only -std=c++11 a.cc <iostream> => 0.35s <regex> => 0.68s
23 lines
620 B
C++
23 lines
620 B
C++
#pragma once
|
|
|
|
#include "lsp_completion.h"
|
|
|
|
#include <optional.h>
|
|
|
|
#include <mutex>
|
|
|
|
// Cached completion information, so we can give fast completion results when
|
|
// the user erases a character. vscode will resend the completion request if
|
|
// that happens.
|
|
struct CodeCompleteCache {
|
|
// NOTE: Make sure to access these variables under |WithLock|.
|
|
optional<std::string> cached_path_;
|
|
optional<lsPosition> cached_completion_position_;
|
|
std::vector<lsCompletionItem> cached_results_;
|
|
|
|
std::mutex mutex_;
|
|
|
|
void WithLock(std::function<void()> action);
|
|
bool IsCacheValid(lsTextDocumentPositionParams position);
|
|
};
|