10using namespace llvm::json;
11using namespace lspserver;
13void Controller::onDocumentDidOpen(
19 actOnDocumentAdd(
File, Version);
22void Controller::onDocumentDidChange(
25 auto Code = Store.getDraft(
File);
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));
43 actOnDocumentAdd(
File, Version);
static std::string encodeVersion(std::optional< int64_t > LSPVersion)
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)
std::vector< TextDocumentContentChangeEvent > contentChanges
The actual content changes.
VersionedTextDocumentIdentifier textDocument
TextDocumentIdentifier textDocument
The document that was closed.
TextDocumentItem textDocument
The document that was opened.
URIForFile uri
The text document's URI.
std::optional< int64_t > version
std::string text
The content of the opened text document.
URIForFile uri
The text document's URI.
llvm::StringRef file() const
Retrieves absolute path to the file.
std::optional< std::int64_t > version