nixd
|
#include <DraftStore.h>
Classes | |
struct | Draft |
Public Member Functions | |
std::optional< Draft > | getDraft (PathRef File) const |
std::vector< Path > | getActiveFiles () const |
std::string | addDraft (PathRef File, llvm::StringRef Version, llvm::StringRef Contents) |
void | removeDraft (PathRef File) |
Remove the draft from the store. | |
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > | asVFS () const |
Static Public Member Functions | |
static std::string | encodeVersion (std::optional< int64_t > LSPVersion) |
static std::optional< int64_t > | decodeVersion (llvm::StringRef Encoded) |
A thread-safe container for files opened in a workspace, addressed by filenames. The contents are owned by the DraftStore. Each time a draft is updated, it is assigned a version. This can be specified by the caller or incremented from the previous version.
Definition at line 25 of file DraftStore.h.
std::string lspserver::DraftStore::addDraft | ( | PathRef | File, |
llvm::StringRef | Version, | ||
llvm::StringRef | Contents ) |
Replace contents of the draft for File
with Contents
. If version is empty, one will be automatically assigned. Returns the version.
Definition at line 88 of file DraftStore.cpp.
References lspserver::DraftStore::Draft::Contents, lspserver::File, and lspserver::DraftStore::Draft::Version.
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > lspserver::DraftStore::asVFS | ( | ) | const |
Definition at line 131 of file DraftStore.cpp.
References lspserver::DraftStore::Draft::Contents.
|
static |
Definition at line 61 of file DraftStore.cpp.
References lspserver::elog().
|
static |
LSP defines file versions as numbers that increase. treats them as opaque and therefore uses strings instead.
Definition at line 84 of file DraftStore.cpp.
std::vector< Path > lspserver::DraftStore::getActiveFiles | ( | ) | const |
Definition at line 28 of file DraftStore.cpp.
std::optional< DraftStore::Draft > lspserver::DraftStore::getDraft | ( | PathRef | File | ) | const |
Definition at line 18 of file DraftStore.cpp.
References lspserver::File.
void lspserver::DraftStore::removeDraft | ( | PathRef | File | ) |
Remove the draft from the store.
Definition at line 99 of file DraftStore.cpp.
References lspserver::File.