Separate the Spans of Messages and Tags in Doc Comments #670
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the location tracking for doc comments isn't granular. We store a
Span
for the entire comment, and one for each tag (@param ...
,@returns ...
, etc). The spans we store for a tag includes the tag itself and the message that comes after it.This PR augments the location tracking for tags; now we track the tag
@param foo
and the messageThis text is also part of the span
separately. This is more consistent with the locations we store for other Slice constructs (struct.span() doesn't include all the fields inside of it) and is more useful for the language server, which needs to differentiate between these two to tell what a user clicked on.This also lets us remove the
Overview
struct. It only holds aMessage
and aSpan
. But now thatMessage
has it's own span,Overview
is kind of redundant. So I deleted it, and now wherever we held anOverview
we just directly hold aMessage
.This PR also adds support for adding spans together. This way we can recover the span for an entire doc comment by adding together the tag span and the message span.