From: Chinmay Dalal <dalal.chinmay.0101@gmail.com>
To: "João Távora" <joaotavora@gmail.com>
Cc: Nikola Pajkovsky <n.pajkovsky@gmail.com>,
emacs-devel@gnu.org, Dimitri Belopopsky <dimitri@belopopsky.com>,
Po Lu <luangruo@yahoo.com>, Eli Zaretskii <eliz@gnu.org>
Subject: Re: Eglot "inlay hints" landed
Date: Fri, 24 Feb 2023 10:34:01 +0530 [thread overview]
Message-ID: <ypi91qmfps1h.fsf@gmail.com> (raw)
In-Reply-To: <ypi95ybrptvq.fsf@gmail.com>
Chinmay Dalal <dalal.chinmay.0101@gmail.com> writes:
> João Távora <joaotavora@gmail.com> writes:
>
>> On Thu, Feb 23, 2023 at 7:50 PM Nikola Pajkovsky <n.pajkovsky@gmail.com> wrote:
>>>
>>> João Távora <joaotavora@gmail.com> writes:
>>>
>>> > I've just landed Eglot "inlay hints" on lisp/progmodes/eglot.el in the
>>> > emacs-29 branch. It's a feature that some users (including me) were
>>> > looking for for some time.
>>>
>>> Nice work João!
>>>
>>> I tried rust inlay hints, and it does not work for me. I bet it's because
>>> eglot uses label only if it's string. The same problem was in lsp-mode.
>>
>> Actually, I think I have code for that. So please show a reproduction
>> recipe. I think someone reported here that hints are working
>> correctly with rust-analyzer, and I've tried it briefly myself with good
>> results. So it must be something else.
>>
>> João
>
>
> You can look at the end of any long rust function with hl-line-mode on:
> there's an empty overlay but it's supposed to have a link to the
> beginning of the function. Screenshot attached.
>
> I think the bug is in eglot--update-hints-1:
>
> (if (stringp label) label (plist-get label :value))
>
> It should instead be the value of :value from the _first element_ of
> label, as the spec says a label is a string or a _list of_ `InlayHintLabelPart`s:
>
> https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#inlayHint
>
> The response from the server is of this form:
>
> (:position (:line 95 :character 1)
> :label [(:value "fn keyboard_interrupt_handler"
> :location (:uri "file:///home/chinmay/stuff/rust/blog_os/src/interrupts.rs"
> :range (:start (:line 67 :character 26)
> :end (:line 67 :character 52))))]
> :tooltip "fn keyboard_interrupt_handler"
> :paddingLeft t
> :paddingRight
> :json-false)
>
>
> [2. empty overlay --- image/png; swappy-20230224-100015.png]...
Of course, this is not ideal when there are multiple elements in the
label list (but not strictly wrong either). I raised this point when I
opened bug#61412:
https://mail.gnu.org/archive/html/bug-gnu-emacs/2023-02/msg00760.html
Also, can the clickable link be actually implemented using the `keymap`
property of overlays:
https://www.gnu.org/software/emacs/manual/html_node/elisp/Special-Properties.html#index-keymap-of-character
instead of just displaying the text?
Chinmay
next prev parent reply other threads:[~2023-02-24 5:04 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <ypi9cz6ahi5n.fsf@gmail.com>
[not found] ` <83edqqaf8c.fsf@gnu.org>
[not found] ` <2B284D77-97DF-4B3E-89FB-13F0CA93D240@gmail.com>
[not found] ` <CALDnm53otfeDQGr0dWWUhxGLTSuiWTstLXJz1HXQgWLiAgsk=A@mail.gmail.com>
[not found] ` <CA+46MXbbW60t=JccgKGX39jTkOu+i=GZhzSQsfnqBUPb-mnJWg@mail.gmail.com>
2023-02-22 19:42 ` Eglot "inlay hints" landed João Távora
2023-02-23 1:45 ` [SPAM UNSURE] " Stephen Leake
2023-02-23 5:29 ` Chinmay Dalal
2023-02-23 6:31 ` Eli Zaretskii
2023-02-23 9:55 ` Chinmay Dalal
2023-02-23 10:03 ` João Távora
2023-02-23 10:55 ` Dimitri Belopopsky
2023-02-23 11:07 ` João Távora
2023-02-23 12:03 ` João Távora
2023-02-23 13:25 ` Dimitri Belopopsky
2023-02-23 11:05 ` Eli Zaretskii
2023-02-23 11:23 ` João Távora
2023-02-23 12:36 ` Eli Zaretskii
2023-02-23 12:57 ` João Távora
2023-02-23 14:48 ` Eli Zaretskii
2023-02-23 16:09 ` João Távora
2023-02-23 17:17 ` Eli Zaretskii
2023-02-23 17:46 ` João Távora
2023-02-23 18:01 ` Eli Zaretskii
2023-02-23 19:26 ` João Távora
2023-02-23 19:54 ` Eli Zaretskii
2023-02-23 20:03 ` João Távora
2023-02-23 19:27 ` Stefan Monnier
2023-02-23 19:39 ` João Távora
2023-02-23 19:53 ` Stefan Monnier
2023-02-23 20:09 ` João Távora
2023-02-23 22:19 ` Stefan Monnier
2023-02-23 23:59 ` João Távora
2023-02-24 1:08 ` Stefan Monnier
2023-02-24 2:28 ` João Távora
2023-02-24 7:35 ` Eli Zaretskii
2023-02-24 10:42 ` João Távora
2023-02-24 11:33 ` Eli Zaretskii
2023-02-24 12:26 ` João Távora
2023-02-23 10:17 ` Tassilo Horn
2023-02-23 12:55 ` Chinmay Dalal
2023-02-23 19:50 ` Nikola Pajkovsky
2023-02-23 21:35 ` João Távora
2023-02-23 21:45 ` Nikola Pajkovsky
2023-02-24 4:20 ` Chinmay Dalal
2023-02-24 5:04 ` Chinmay Dalal [this message]
2023-02-24 9:59 ` João Távora
2023-02-24 11:03 ` Nikola Pajkovsky
2023-02-27 22:50 ` Johann Klähn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ypi91qmfps1h.fsf@gmail.com \
--to=dalal.chinmay.0101@gmail.com \
--cc=dimitri@belopopsky.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=joaotavora@gmail.com \
--cc=luangruo@yahoo.com \
--cc=n.pajkovsky@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).