Closed microbit-matt-hillsdon closed 1 year ago
lint and signature help have this characteristic, but lint maps errors through document changes so I guess would move the error to the end of the document (and then it'd be replaced by a diagnostics update). So I think we need to do something similar with the position we're intending to show signature help for.
Note: 125, which is the common position for this error is the cursor position in the brackets of a display.show in the default while loop, so that makes a lot of sense.
This is likely fixed by https://github.com/microbit-foundation/python-editor-v3/pull/1054 but leaving open for a bit to monitor impact on reported errors on the beta.
No further incidence on staging so resolving.
We see common traces like this:
RangeError Invalid position 125 in document of length 122 numbers vary though this one is most common
This amounts to a crash in the tooltip module.
I've managed to reproduce it by inserting a significant delay in the removal of a signature help tooltip on the last line of the document and then deleting the line.
We should review all asynchronous tooltip handling.
Detailed repro:
await new Promise((resolve) => setTimeout(resolve, 500));
to the catch block in triggerSignatureHelpRequest (signatureHelp.ts)I suspect there are other repros, but the general idea of it being a tooltip for an invalid position due to async is likely common to them.
Pretty trace from a repro: