Cache calculated file state in LSP (#4897)

Add caching of parsed documents, and testing of the textDocument
handlers. This is based on #4896, which splits out some of the
boilerplate to calls.

Note, this caches the entire parse state because we'll want to try to
emit diagnostics when we see the update, without waiting. It may be
helpful to do that asynchronously, but we don't want to wait for another
call (such as documentSymbol). Really, we'll probably want to also add
check for diagnostics, at least.
This commit is contained in:
Jon Ross-Perkins
2025-02-07 01:04:42 +00:00
committed by GitHub
parent 55714dd4ed
commit 9e466b9335
28 changed files with 498 additions and 51 deletions
+6
View File
@@ -57,6 +57,12 @@ class SourceBuffer {
}
}
// Returns a source buffer with the provided text content. Copies `filename`
// and `text` to take ownership.
static auto MakeFromStringCopy(llvm::StringRef filename, llvm::StringRef text,
DiagnosticConsumer& consumer)
-> std::optional<SourceBuffer>;
// Use one of the factory functions above to create a source buffer.
SourceBuffer() = delete;