Skip to content

feat: Inlay hints with text edits can be applied when clicking on them#1505

Draft
FlorianKroiss wants to merge 1 commit intoeclipse-lsp4e:mainfrom
FlorianKroiss:inlay-text-edits
Draft

feat: Inlay hints with text edits can be applied when clicking on them#1505
FlorianKroiss wants to merge 1 commit intoeclipse-lsp4e:mainfrom
FlorianKroiss:inlay-text-edits

Conversation

@FlorianKroiss
Copy link
Contributor

@FlorianKroiss FlorianKroiss commented Feb 26, 2026

Inlay hints can have text-edits, which VS Code applies when double clicking on them. We already had support for executing commands when clicking on individual parts of the inlay hint. With this PR, we additionally check if there are text-edits and apply them, when the user clicks on it.

It looks like this in action:
https://github.com/user-attachments/assets/aa7bd610-e727-40bf-b326-b8ca468552c0

In the above example, the LS inferred the type of the right hand side expression and the user can accept the inferred type.

@FlorianKroiss
Copy link
Contributor Author

Labelled as draft, because I'm not entirely happy with it. I'm not sure if the LSP defines whether a command or the text edits takes precedence, when the user clicks on the inlay hint.

I also think that accepting the inlay hint with a single click makes it easy to trigger by accident.
Maybe we can say

  • Apply text-edit, if there is one, on double click. In this case we should show a tooltip or something, to let the user know about this. ( <- VS Code does this)
  • Execute command, if there is one, on single click

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant