eclipse / xtext-eclipse

xtext-eclipse
Eclipse Public License 2.0
49 stars 73 forks source link

Unstable ordering of markers in AnnotatedTextToString #1987

Closed eliericha closed 1 year ago

eliericha commented 1 year ago

Markers are currently sorted by region start only. So when multiple markers have the same region start, they are ordered undeterministically among each other. That makes it difficult to use in some test scenarios as we can't compare to a fixed reference.

I'll try to make a submission to fix this.

cdietrich commented 1 year ago

hi, what is your proposed fix?

eliericha commented 1 year ago

I suggest that after ordering by region start, we order markers with the same region start by their message. That way we should get a deterministic outcome.

cdietrich commented 1 year ago

so the end/stop you wont consider?

eliericha commented 1 year ago

Ah that's a good point. Indeed we could sort by end, and then by message. From the looks of the code it's easy to chain comparators.

cdietrich commented 1 year ago

can you provide a pr

eliericha commented 1 year ago

Yes. I also have a minor fix that avoid a NPE elsewhere. Should I submit in the same PR or open a different issue?

eliericha commented 1 year ago

I opted to include the minor NPE fix, but let me know if you'd rather proceed otherwise.

cdietrich commented 1 year ago

thx for the fix @eliericha