Document snapshots represent the state of a document at a certain point in time. For instance if a user is typing character by character abc this would result in 1-3 document snapshots depending on how frequently the IDE client on the other end of the language server sent updates. For instance the client could do: a at 0 -> b at 1 -> c at 2 resulting in 3 document snapshots:
a
ab
abc
But it could also be sent as ab at 0 -> c at 2 resulting in 2 document snaphots
ab
abc
This issue doesn't track creating/updating snapshots its reason is to provide a common type that other infrastructure bits can use to make decisions.
Basic structure of a document snapshot
string Path { get; }
long Version { get; }
// We should probably just use Roslyn's data type here for text because it's a hackathon
Task<SourceText> GetTextAsync();
// Dependent on https://github.com/protobuflab/protobuf-langserver/issues/1
Task<SyntaxTreeType> GetSyntaxTreeAsync();
Document snapshots are immutable and data that's calculated to provide results to methods such as GetSyntaxTreeAsync and GetTextAsync are typically memoized.
Document snapshots represent the state of a document at a certain point in time. For instance if a user is typing character by character
abc
this would result in 1-3 document snapshots depending on how frequently the IDE client on the other end of the language server sent updates. For instance the client could do:a
at 0 ->b
at 1 ->c
at 2 resulting in 3 document snapshots:a
ab
abc
But it could also be sent as
ab
at 0 ->c
at 2 resulting in 2 document snaphotsab
abc
This issue doesn't track creating/updating snapshots its reason is to provide a common type that other infrastructure bits can use to make decisions.
Basic structure of a document snapshot
Document snapshots are immutable and data that's calculated to provide results to methods such as
GetSyntaxTreeAsync
andGetTextAsync
are typically memoized.