[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Eglot "inlay hints" landed
From: |
Chinmay Dalal |
Subject: |
Re: Eglot "inlay hints" landed |
Date: |
Fri, 24 Feb 2023 09:50:47 +0530 |
User-agent: |
mu4e 1.9.1; emacs 30.0.50 |
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)
swappy-20230224-100015.png
Description: empty overlay
- Re: Eglot "inlay hints" landed, (continued)
- Re: Eglot "inlay hints" landed, Stefan Monnier, 2023/02/23
- Re: Eglot "inlay hints" landed, João Távora, 2023/02/23
- Re: Eglot "inlay hints" landed, Eli Zaretskii, 2023/02/24
- Re: Eglot "inlay hints" landed, João Távora, 2023/02/24
- Re: Eglot "inlay hints" landed, Eli Zaretskii, 2023/02/24
- Re: Eglot "inlay hints" landed, João Távora, 2023/02/24
Re: Eglot "inlay hints" landed, Tassilo Horn, 2023/02/23
Re: Eglot "inlay hints" landed, Chinmay Dalal, 2023/02/23
Re: Eglot "inlay hints" landed, Nikola Pajkovsky, 2023/02/24
Re: Eglot "inlay hints" landed, Nikola Pajkovsky, 2023/02/24
Re: Eglot "inlay hints" landed, Johann Klähn, 2023/02/27