Skip to content

Typed characters sometimes appear behind closing labels #423

Closed

Description

@DanTup

Raised by @xster at #383 (comment)

Minor UI issue: noticed it was possible to momentarily type text behind the labels.

labels

Activity

  1. added this to the v2.4.1 milestone on Sep 7, 2017
  2. DanTup commented on Sep 15, 2017

    @DanTup
    MemberAuthor

    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

  3. modified the milestones: v2.4.1, on Sep 15, 2017
  4. devoncarew commented on Sep 27, 2017

    @devoncarew
    Contributor

    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
  5. DanTup commented on Sep 27, 2017

    @DanTup
    MemberAuthor

    we can attach Inlays to the end of an offset

    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.

  6. devoncarew commented on Sep 27, 2017

    @devoncarew
    Contributor

    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.

  7. added
    in editorRelates to code editing or language features
    on Nov 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresis bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions