Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inlay hints causes newly typed characters to move in a ping-pong pattern #2235

Open
Drakim opened this issue Apr 9, 2023 · 1 comment
Open
Labels
sublime issue Issues related to shortcomings or bugs in the ST API

Comments

@Drakim
Copy link

Drakim commented Apr 9, 2023

Describe the bug
Inlay hints will awkwardly get in the way of the cursor while typing, causing the newly typed character to appear after the inlay hint, only for the inlay hint to jump back before the newly created character on the next frame. See my animated screenshot for clarity.

To Reproduce
Steps to reproduce the behavior:

  1. Use LSP and LSP-volar
  2. Enable all the inlay hint settings for LSP-volar, and "show_inlay_hints" in LSP
  3. Write const test = 5;
  4. Observe the inlay hint saying :number appear after the test variable name.
  5. Put the caret right before an inlay hint
  6. Type some characters
  7. Observe the characters ping-ponging
  8. Suffer

Expected behavior
When typing a character right before an inlay hint, the inlay hint should be pushed one index to the right, so that the newly typed character is before the inlay hint, not after.

Screenshots
bug

Environment:

  • OS: Windows 10 Pro 21H2
  • Sublime Text version: 4143
  • LSP version: 1.23.0
  • Language servers used: LSP-volar v2.3.0

Additional context
Also I'm unsure if this is related or not, but whether I'm allowed to put a caret before or after an inlay hint seems somewhat random.

bug2
bug3

I'm pressing left/right here, and as you can see see my caret is jumping between very different positions. It's not exactly random, it appears to be based on whether I last backspaced or typed a character on the variable. So there is something funky going on with the inlay hint's position based on your input.

I find the version where I'm allowed to put my caret like in the first example vastly superior, it's just weird to have the inlay hint smack dab in the middle of the variable name as I'm typing out the rest of the word: "test[hint]ing", only for the [hint] to correct itself afterwards.

@rchl rchl added the sublime issue Issues related to shortcomings or bugs in the ST API label Apr 10, 2023
@rchl
Copy link
Member

rchl commented Apr 10, 2023

There is a couple of ST issues filed for phantom handling. See Issues with phantoms used for Inlay Hints in #2007

I suppose I can keep this one open on our side for tracking but it's not something we can solve (at least not reliably and without hacks).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sublime issue Issues related to shortcomings or bugs in the ST API
Projects
None yet
Development

No branches or pull requests

2 participants