clang-tools
11.0.0
|
A thread-safe container for files opened in a workspace, addressed by filenames. More...
#include <DraftStore.h>
Classes | |
struct | Draft |
Public Member Functions | |
llvm::Optional< Draft > | getDraft (PathRef File) const |
std::vector< Path > | getActiveFiles () const |
int64_t | addDraft (PathRef File, llvm::Optional< int64_t > Version, StringRef Contents) |
Replace contents of the draft for File with Contents . More... | |
llvm::Expected< Draft > | updateDraft (PathRef File, llvm::Optional< int64_t > Version, llvm::ArrayRef< TextDocumentContentChangeEvent > Changes) |
Update the contents of the draft for File based on Changes . More... | |
void | removeDraft (PathRef File) |
Remove the draft from the store. More... | |
A thread-safe container for files opened in a workspace, addressed by filenames.
The contents are owned by the DraftStore. This class supports both whole and incremental updates of the documents. Each time a draft is updated, it is assigned a version number. This can be specified by the caller or incremented from the previous version.
Definition at line 28 of file DraftStore.h.
int64_t clang::clangd::DraftStore::addDraft | ( | PathRef | File, |
llvm::Optional< int64_t > | Version, | ||
StringRef | Contents | ||
) |
Replace contents of the draft for File
with Contents
.
If no version is specified, one will be automatically assigned. Returns the version.
Definition at line 50 of file DraftStore.cpp.
References Contents, clang::clangd::DraftStore::Draft::Contents, clang::clangd::File, clang::clangd::updateVersion(), and clang::clangd::DraftStore::Draft::Version.
std::vector< Path > clang::clangd::DraftStore::getActiveFiles | ( | ) | const |
Definition at line 27 of file DraftStore.cpp.
llvm::Optional< DraftStore::Draft > clang::clangd::DraftStore::getDraft | ( | PathRef | File | ) | const |
Definition at line 17 of file DraftStore.cpp.
References clang::clangd::File, and clang::clangd::None.
void clang::clangd::DraftStore::removeDraft | ( | PathRef | File | ) |
Remove the draft from the store.
Definition at line 131 of file DraftStore.cpp.
References clang::clangd::File.
llvm::Expected< DraftStore::Draft > clang::clangd::DraftStore::updateDraft | ( | PathRef | File, |
llvm::Optional< int64_t > | Version, | ||
llvm::ArrayRef< TextDocumentContentChangeEvent > | Changes | ||
) |
Update the contents of the draft for File
based on Changes
.
If a position in Changes
is invalid (e.g. out-of-range), the draft is not modified. If no version is specified, one will be automatically assigned.
File
, or an error if the changes couldn't be applied. Definition at line 60 of file DraftStore.cpp.
References Changes, Contents, and clang::clangd::File.