10using namespace llvm::json;
13void Controller::onDocumentDidOpen(
16 const std::string &Contents =
Params.textDocument.text;
17 std::optional<int64_t> Version =
Params.textDocument.version;
19 actOnDocumentAdd(
File, Version);
22void Controller::onDocumentDidChange(
27 log(
"Trying to incrementally change non-added document: {0}",
File);
30 std::string
NewCode(*Code->Contents);
37 elog(
"Failed to update {0}: {1}",
File, std::move(
Err));
41 std::optional<int64_t> Version =
Params.textDocument.version;
43 actOnDocumentAdd(
File, Version);
static std::string encodeVersion(std::optional< int64_t > LSPVersion)
std::optional< Draft > getDraft(PathRef File) const
std::string addDraft(PathRef File, llvm::StringRef Version, llvm::StringRef Contents)
Whether current platform treats paths case insensitively.
llvm::Error applyChange(std::string &Contents, const TextDocumentContentChangeEvent &Change)
Apply an incremental update to a text document.
void elog(const char *Fmt, Ts &&...Vals)
void log(const char *Fmt, Ts &&...Vals)
bool fromJSON(const llvm::json::Value &Params, Configuration::Diagnostic &R, llvm::json::Path P)