icerpc / slicec

The Slice compiler library
Apache License 2.0
13 stars 5 forks source link

Separate the Spans of Messages and Tags in Doc Comments #670

Closed InsertCreativityHere closed 10 months ago

InsertCreativityHere commented 10 months ago

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.

@param foo: This text is also part of the span!

This PR augments the location tracking for tags; now we track the tag @param foo and the message This 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 a Message and a Span. But now that Message has it's own span, Overview is kind of redundant. So I deleted it, and now wherever we held an Overview we just directly hold a Message.


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.