proc-macro2 icon indicating copy to clipboard operation
proc-macro2 copied to clipboard

documentation variants with shifted spans for content

Open drahnr opened this issue 5 years ago • 1 comments

Attempting to parse doc comments I find myself in need of various adjustments so the string representation and the actual span length are equiv as well as extracting a span that covers just the literal spans check https://github.com/drahnr/cargo-spellcheck/blob/master/src/documentation/literal.rs#L104-L123 .

While the above is only for ascii due to the len, just adding " in a /// comment breaks the above.

I.e. /// if a layer is provided a identiacla "input" and "output", it will only be supplied an would become a rendered literal "/// if a layer is provided a identiacla \"input\" and \"output\", it will only be supplied an would"` with a unexpected length and also a wrong (from application pov) span.

How would I extract the correct span for the actual documentation content?

Any help would be highly appreciated.

drahnr avatar Jul 24 '20 14:07 drahnr

There are already a bunch of tests in an attempt the correct span https://github.com/drahnr/cargo-spellcheck/blob/master/src/documentation/literal.rs#L302-L591

drahnr avatar Jul 24 '20 14:07 drahnr