You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Diagnostics of multiple tuples of the same uri will be merged, e.g [[file1, [d1]], [file1, [d2]]] is equivalent to [[file1, [d1, d2]]]. If a diagnostics item is undefined as in [file1, undefined] all previous but not subsequent diagnostics are removed.
However, this doesn't work in practice because the entries end up being sorted by uri, but the sort is not stable. Here's the code that does the sort. This can result in entries being reordered so that this...
So, that's what you get when you rely on un-specified behaviour... It seems that v8 is especially mean because it uses stable-sorting for small arrays and unstable-sorting for larger arrays.
Small arrays are sorted using a simpler algorithm which happens to be stable.
You need a larger array to trigger the quicksort algorithm which is non-stable.
The documentation for
DiagnosticCollection.set([Uri, Diagnostic[]][])
states the following:However, this doesn't work in practice because the entries end up being sorted by uri, but the sort is not stable. Here's the code that does the sort. This can result in entries being reordered so that this...
...becomes this...
That results in diagnostics being cleared when they aren't supposed to be.
The text was updated successfully, but these errors were encountered: