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
{{ message }}
Repository navigation
Typed characters sometimes appear behind closing labels #423
I think this is going to need Code support... The idea of just attaching the label to the last character on the line is kinda flawed because the user can type there!
Hey - just to provide some feedback about how IntelliJ / the Dart plugin there solves this:
we can attach Inlays to the end of an offset, so typing chars will just push the Inlay to the right (Inlays are the IntelliJ mechanism for inserted synthetic text)
in the Dart plugin, we ignore notifications for closing labels if we have unsent changes for that file (so, chars typed but not yet sent to the analysis server). Those unsent chars will be sent, processed by the analysis server, and we'll receive a new closing label notification for the file w/ correct offsets, so the system will catch up naturally w/ typing changes
In Code, if we attach to the end of the range, the labels appear there (eg. inline - like the original prototype did). This was considered undesirable so we wanted to anchor to the "end of the line", but Code doesn't support that so we had to anchor to the end of the character-currently-at-the-end-of-the-line - but this allows a user to type behind it :(
That said, I wonder if DecorationRangeBehavior.ClosedOpen would fix this - maybe new characters typed directly at the end would then extend the range instead. I'll try and test this!
in the Dart plugin, we ignore notifications for closing labels if we have unsent changes for that file
In Dart Code we do something similar, but basically add a delay and throw away any notifications if another arrives within that period. I don't know if your solution might still have races - eg. if the server prepares some closing labels but before they're processed by you, the user types another key which then gets transmitted - then you receive the stale result? Possibly your buffering of keys introduces some delays that offsets this (similar to our delay). I think the best fix for that is dart-lang/sdk#30301 though it might be a lot of effort for a few edge cases.
This was considered undesirable so we wanted to anchor to the "end of the line"
Yup, for my comment I meant that we were anchoring to the offset of the last char in a line.
In terms of buffering, I'm not certain that there aren't any race conditions, but we haven't seen any in practice, and they would be things that worked themselves out w/ the next analyzer notification.
Activity
DanTup commentedon Sep 15, 2017
I think this is going to need Code support... The idea of just attaching the label to the last character on the line is kinda flawed because the user can type there!
Opened microsoft/vscode#34441
devoncarew commentedon Sep 27, 2017
Hey - just to provide some feedback about how IntelliJ / the Dart plugin there solves this:
DanTup commentedon Sep 27, 2017
In Code, if we attach to the end of the range, the labels appear there (eg. inline - like the original prototype did). This was considered undesirable so we wanted to anchor to the "end of the line", but Code doesn't support that so we had to anchor to the end of the character-currently-at-the-end-of-the-line - but this allows a user to type behind it :(
That said, I wonder if
DecorationRangeBehavior.ClosedOpenwould fix this - maybe new characters typed directly at the end would then extend the range instead. I'll try and test this!In Dart Code we do something similar, but basically add a delay and throw away any notifications if another arrives within that period. I don't know if your solution might still have races - eg. if the server prepares some closing labels but before they're processed by you, the user types another key which then gets transmitted - then you receive the stale result? Possibly your buffering of keys introduces some delays that offsets this (similar to our delay). I think the best fix for that is dart-lang/sdk#30301 though it might be a lot of effort for a few edge cases.
devoncarew commentedon Sep 27, 2017
Yup, for my comment I meant that we were anchoring to the offset of the last char in a line.
In terms of buffering, I'm not certain that there aren't any race conditions, but we haven't seen any in practice, and they would be things that worked themselves out w/ the next analyzer notification.