mirror of
https://github.com/google/ormolu.git
synced 2024-11-23 14:16:24 +03:00
803f76aab9
I'm not sure it's perfect, but it fixes the original issue and all the tests pass. The problem was in entering with locate (or some version of it) the same span twice. So the algorithm saw an element with identical enclosing element and the ‘commentFollowsElt’ function got confused. The solution is two first augment registration of enclosing spans to allow us to keep more than one item there. Then we can filter out spans which are just copies of current reference span to get to the “real” enclosing span. It seems to make sense to attach comments to child element if it starts exactly at the same position of parent element, hence the distance between start of enclosing/reference span and start of comment is the same, thus changing ‘>’ to ‘>=’ in ‘commentFollowsElt’. |
||
---|---|---|
.. | ||
examples | ||
printer |