sun::lsp::DiagnosticsCache

sun::lsp::DiagnosticsCache

class · Source (opens in a new tab)

class sun::lsp::DiagnosticsCache

Stores analysis results so unchanged documents can reuse diagnostics.

Public Functions

clear

public · function · Source (opens in a new tab)

void sun::lsp::DiagnosticsCache::clear()

Removes all cached document diagnostics.

computeHash

public · function · static · Source (opens in a new tab)

static std::string sun::lsp::DiagnosticsCache::computeHash(const std::string &content)

Computes the content key used to reuse document diagnostics.

get

public · function · Source (opens in a new tab)

const llvm::json::Array & sun::lsp::DiagnosticsCache::get(const std::string &hash) const

Returns cached diagnostics for a document content hash when available.

has

public · function · Source (opens in a new tab)

bool sun::lsp::DiagnosticsCache::has(const std::string &hash) const

Reports whether diagnostics have been cached for the supplied content hash.

invalidate

public · function · Source (opens in a new tab)

void sun::lsp::DiagnosticsCache::invalidate(const std::string &hash)

Removes diagnostics associated with an outdated content hash.

put

public · function · Source (opens in a new tab)

void sun::lsp::DiagnosticsCache::put(const std::string &hash, llvm::json::Array diagnostics)

Caches diagnostics under the document content hash.

size

public · function · Source (opens in a new tab)

size_t sun::lsp::DiagnosticsCache::size() const

Returns the number of stored entries.

Private Fields

cache_

private · variable · Source (opens in a new tab)

std::unordered_map<std::string, llvm::json::Array> sun::lsp::DiagnosticsCache::cache_

No documentation comment.

maxEntries_

private · variable · static · Source (opens in a new tab)

size_t sun::lsp::DiagnosticsCache::maxEntries_ = 100

No documentation comment.