Skip to content

Fix wrong inlay hint positions in large documents - #993

Merged
DaelonSuzuka merged 1 commit into
godotengine:masterfrom
Nallebeorn:inlay-type-hints-range
Mar 10, 2026
Merged

Fix wrong inlay hint positions in large documents#993
DaelonSuzuka merged 1 commit into
godotengine:masterfrom
Nallebeorn:inlay-type-hints-range

Conversation

@Nallebeorn

Copy link
Copy Markdown
Contributor

Closes #980.

Fixes missing or misplaced inlay hints in GDScript and scene files, when scrolled down in a somewhat large document,

The extension respected the range parameter of provideInlayHints by extracting only that range substring for processing, but it didn't take the range into account when calculating positions for the LSP request or hint placement. So the position was incorrect any time the range start was non-zero.

The range is relative to vertical scroll position but with some padding. From my quick scan of the relevant function in the VS Code source the document size needed to reproduce should be something like two viewport heights tall plus 30 lines, so the bug is probably dependent on window and font size too :)

The linked issue has a repro GDScript (at least for me when fitting ~60 lines in the viewport). The bug also exists in scene files -- if you have a decent number of nodes with resources in the tree you'll find that the resource path hints are missing when scrolled down. I've attached a MRP with both a script and scene for testing convenience: inlay-hints-test_2026-03-09_20-31-25.zip

@DaelonSuzuka

Copy link
Copy Markdown
Collaborator

I've definitely seen the inlay hints positioned correctly in large documents scrolled 2+ pages down. I wonder why it's been intermittent for me...

Regardless, very simple fix, thank you for investigating!

@DaelonSuzuka
DaelonSuzuka merged commit b0273b1 into godotengine:master Mar 10, 2026
4 checks passed
@Calinou Calinou added the bug label Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Undesirable inlay type hints displayed in incorrect positions in some scripts

3 participants