-
Notifications
You must be signed in to change notification settings - Fork 235
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: traverse ghost locations #1892
Conversation
Here is the PR that introduced the "avoid-ghost-location" ocaml/ocaml-lsp#1290 for context. |
In commit 598e863 I proposed yet another fix. We can rely on the merlin.hide attribute introduced by well-behaved code generators ! |
Seems reasonnable to rely on merlin.hide attributes for this indeed. I wonder what happens in other cases were the compiler introduces ghost locations. Standard example of these are the use of punning in record's label names and function labels. Could you add such examples to your test ? |
Closed in favor of #1894 |
Description
Consider the following code:
In this case, an inlay hint appears for
x
inf
, but no hint is shown forg
.In VS Code, this results in the following display:
Issue
The inlay hints implementation includes logic to stop traversing "ghost locations" to avoid annotating generated code. However, a simple definition like:
is syntactic sugar for:
where
fun x ->
introduces a ghost location. This explains why the ghost location check had to be explicitly disabled in your test.Proposed Fix
This PR modifies the traversal logic to allow ghost locations even if they originate from "generated code." Instead of blocking traversal, ghost locations are filtered when generating inlay hints.