pub fn extract_annotations(text: &str) -> Vec<(TextRange, String)>
Expand description
Extracts //^^^ some text
annotations.
A run of ^^^
can be arbitrary long and points to the corresponding range
in the line above.
The // ^file text
syntax can be used to attach text
to the entirety of
the file.
Multiline string values are supported:
// ^^^ first line // | second line
Trailing whitespace is sometimes desired but usually stripped by the editor
if at the end of a line, or incorrectly sized if followed by another
annotation. In those cases the annotation can be explicitly ended with the
$
character.
// ^^^ trailing-ws-wanted $
Annotations point to the last line that actually was long enough for the range, not counting annotations themselves. So overlapping annotations are possible:
// stuff other stuff
// ^^ 'st'
// ^^^^^ 'stuff'
// ^^^^^^^^^^^ 'other stuff'