Subject: bug#61412: Inlay hints implementation

From: João Távora <[email-masked]>
Date: Tue, 21 Feb 2023 15:13:03 +0000

[Eli, I just noticed that this bug should be merged with 61066,
but I don't know how to do that]

Hello,

Attached is my implementation of inlay hints for Eglot.
Two patches are provided, where the first just lays some
basic groundwork to make the actual inlay hint implementation
simpler.

Regarding copyright stuff, I did look at Chinmay's patch,
but I re-started from scratch.  While it was a very good
effort, there were too many idiomatic Elisp and Eglot things
to change.  I did take Chinmay's face definitions, though.
Not sure how to proceed here and if this counts as "derived
work" and if we should wait for Chinmay's copyright assignment.

I gave it some light testing and I kind of like it.  Quite
helpful for C++ with clangd (the only server I tested it with).
You can bind `eglot-inlay-hint-mode` to some keybinding probably.

Documentation in the manual is still missing, but shouldn't
be very hard to do.

Anyway, this is likely not the end of the inlay hint story
because, as the second patch documents, this is likely a
very naive implementation that always requests inlay hints
for the entire buffer even if just a fraction of it is visible.

A better implementation would probably leverage
window-scroll-functions along with the Eglot-specific
idle timer.  That is probably much, much more tricky to get
right, but is also more than likely the way to go.

In the meantime, I'd like your opinion on this patch and
the above topics first.

João

I hope gmail doesn't mess up my attachments...