Subject: bug#61412: Inlay hints implementation

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

Ok, thanks.  While I'm sure Flymake can be used for this,
I'm not sure it should.  The reason is that inlay hints are,
in principle, much more numerous than diagnostics.  Collecting
all of them could be wasteful when the user is only looking at
a section of the file.  Flymake doesn't have very good
mechanisms to work with this scenario.

Anyway, your patch has a very large number of unrelated whitespace
changes, making it almost impossible to read.  Please make one
with only the essential changes.

João

On Tue, Feb 21, 2023 at 6:42 PM Dimitri Belopopsky
<[email-masked]> wrote:
>
> Hello,
>
> I thought the point was not to create overlays directly?
> I'm sharing what I currently have, using the flymake diagnostics directly.
> Maybe something can be salvaged?
>
> In the meantime I'll try out your patches.
>
> On Tue, 21 Feb 2023 at 16:14, João Távora <[email-masked]> wrote:
>>
>> [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.
>
>
> It's even more helpful in languages like Rust, that rely on type deduction a lot more.
> Clangd has an extension for designator hints that looks interesting too.
>
>>
>> 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...

-- 
João Távora