Zero width trivia #221
This will mess with TokenAtOffset::Between. Do you think we should skip zero-len tokens there (meaning the tokens won't necessarily be consecutive siblings), or keeping them as one side (which might not be what code expects)? If they are only used after editing, then this is probably not a problem - do we edit for permanent trees (i.e. outside assists and for viewing)?
This will mess with TokenAtOffset::Between. Do you think we should skip zero-len tokens there (meaning the tokens won't necessarily be consecutive siblings), or keeping them as one side (which might not be what code expects)? If they are only used after editing, then this is probably not a problem - do we edit for permanent trees (i.e. outside assists and for viewing)?
We already skip empty children in TokenAtOffset, so the tokens in between aren't necessarily consecutive siblings, and that's fine. Yup, these markers are introduced by the editing layer (make tokens and the editor's remove/splice operations) and only exist in temporary trees. We do edit trees outside assists too, I guess during expansion, and some pretifying macro, but none of those trees are persisted. I think we convert them to tt, so ya no permanent tree.
We didn't have any empty tokens in r-a until this.
Also I think there was some rowan API which could panic with empty tokens, I need to remember which.
ChayimFriedman2
bit-aloo
We allow rowan to include zero width trivia. These are needed to mark element boundaries, helping us determine whether certain post edit heuristics should be applied. Roslyn uses a similar concept with zero width trivia whcih they call elastic triva to mark locations where formatting may be applied.