emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Eglot "inlay hints" landed


From: João Távora
Subject: Re: Eglot "inlay hints" landed
Date: Thu, 23 Feb 2023 19:39:28 +0000

On Thu, Feb 23, 2023 at 7:28 PM Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
> > I'd love to switch over to the jit-lock implementation as it has
> > potential to be much neater.  But I can't seem to get it to not
> > over-request stuff. I attach the patch I've been trying, and it's
> > clearly got some thinkos when you test it.  It doesn't help that
> > `window-start` and `window-end` aren't -- apparently -- reliable
> > when called from a jit-lock function.
>
> Sorry, I have not followed the discussion, so I don't know what are
> "inlay hints" nor how to test them.  What problem do you see what you
> try your code?

Hi Stefan.  Inlay hints are described summarily in the very first
message to this thread and in the commit implementing them.  They're
very many 0-length overlays, almost like tooltips, annotating
type deductions and positional parameter names.

The goal here is to request them at the correct time and balance
multiple objectives:

1. minimize the number of requests
2. ensure the request covers all visible portions of the buffer
across any windows showing it.
3. don't request for too large a region, else the amount of data can
be prohibitive.

The latest message I sent to Eli has my best shot at it.  If you have
a clangd executable somewhere, you can test this rather easily with
the eglot.el in core and a cpp file such as

void foo(int bar) {}

int main() {
   foo(42);
   foo(42);
  ... very many lines of this ...
   foo(42);
   foo(42);
   foo(42);
}

You should see some intangible text appear in the buffer so that
it will look like:


void foo(int bar) {}

int main() {
   foo( bar: 42);
   foo( bar: 42);
  ... very many lines of this ...
   foo( bar: 42);
   foo( bar: 42);
   foo( bar: 42);
}

Then scroll around in the buffer and check the traces of
eglot--update-hints-1.  Try to change that 'int bar' to
'int quux' and see if the system reacts correctly to the change
updating the ' bar: ' hint to ' quux: '.

See also my last message to Eli, which contains a horrible
patch that nevertheless does more or less achieve those
objectives.

João



reply via email to

[Prev in Thread] Current Thread [Next in Thread]