2017-12-05 07:57:41 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "language_server_api.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_;
|
2017-12-12 05:20:29 +00:00
|
|
|
std::vector<lsCompletionItem> cached_results_;
|
2017-12-05 07:57:41 +00:00
|
|
|
|
|
|
|
std::mutex mutex_;
|
|
|
|
|
|
|
|
void WithLock(std::function<void()> action);
|
|
|
|
bool IsCacheValid(lsTextDocumentPositionParams position);
|
|
|
|
};
|