This ties to an LSP feature (diagnostic versioning) but really a lot
of the value is in being able to log what's happening with file versions
and queues more descriptively and clearly.
As such it's fairly invasive, for a logging patch :-\
Key decisions:
- at the LSP layer, we don't reqire the client to provide versions (LSP makes it mandatory but we never enforced it). If not provided, versions start at 0 and increment. DraftStore handles this.
- don't propagate magically using contexts, but rather manually: addDocument -> ParseInputs -> (ParsedAST, Preamble, various callbacks) Context-propagation would hide the versions from ClangdServer, which would make producing good log messages hard
- within ClangdServer, treat versions as opaque and unordered. json::Value is a convenient type for this, and allows richer versions for embedders. They're "mandatory" but nullptr is a sensible default.
can we rather have Optional<int>s here(both for callbacks and addDocument)?
as clangdserver layer doesn't touch json objects at all currently.