From: Milan Jovanovic <milanj@gmail.com>
To: "João Távora" <joaotavora@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
Krzysztof Klimonda <kklimonda@syntaxhighlighted.com>,
Stefan Monnier <monnier@iro.umontreal.ca>,
64101@debbugs.gnu.org
Subject: bug#64101: 29.0.91; Eglot inlay hints rendered out of order
Date: Mon, 19 Jun 2023 23:05:49 +0200 [thread overview]
Message-ID: <410CA10A-75BB-4F88-B974-E69E349B3064@gmail.com> (raw)
In-Reply-To: <CALDnm503LLjurGkmue70odjMYUHZx3UMGdQf8jyHitkJVwC+nA@mail.gmail.com>
Looks like overlays render order depends on before-string/after-string property (beside priority).
Type hints overlays are ‘before-string and function parameter hints overlays are ‘after-string (so parameter hint parts are sorted by overlay descending priority).
If you change it to ‘before-string also (and adjust overlay start/end to be as in type hints) it will work as it should.
Btw. I still don’t understand why parts of one hint can’t be simply merged.
Anyway, my recipe to recreate issue:
% rust-analyzer --version
rust-analyzer 1.70.0 (90c54180 2023-05-31) —> last rustup version (`rustup component add rust-analyzer`)
% /Applications/Emacs.app/Contents/MacOS/Emacs --version
GNU Emacs 29.0.91
% ls .emacs.d
auto-save-list elpa
ls .emacs.d/elpa
archives eglot-1.15 eglot-1.15.signed eldoc-1.14.0 eldoc-1.14.0.signed gnupg
(eglot.el is patched with diff from João email)
% cargo new inlay-hints
>>> paste this code into inlay-hints/src/main.rs
fn main() {
let mut c = vec![1,2,3];
c.insert(0, 0);
}
<<<<
% cd inlay-hints
% /Applications/Emacs.app/Contents/MacOS/Emacs src/main.rs -f rust-ts-mode -f eglot
Eglot events:
(:jsonrpc "2.0" :id 13 :result
[(:position
(:line 1 :character 11)
:label
[(:value ": ")
(:value "Vec" :location
(:uri "file:///Users/milan/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs" :range
(:start
(:line 395 :character 11)
:end
(:line 395 :character 14))))
(:value "<i32>")]
:kind 1 :paddingLeft :json-false :paddingRight :json-false)
(:position
(:line 2 :character 11)
:label
[(:value "index" :location
(:uri "file:///Users/milan/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs" :range
(:start
(:line 1434 :character 29)
:end
(:line 1434 :character 34))))
(:value ":")]
:kind 2 :paddingLeft :json-false :paddingRight t)
(:position
(:line 2 :character 13)
:label
[(:value "element" :location
(:uri "file:///Users/milan/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs" :range
(:start
(:line 1434 :character 43)
:end
(:line 1434 :character 50))))
(:value ":")]
:kind 2 :paddingLeft :json-false :paddingRight t)])
Trace output:
======================================================================
1 -> (make-overlay 25 26 nil t)
1 <- make-overlay: #<overlay from 25 to 26 in main.rs>
======================================================================
1 -> (overlay-put #<overlay from 25 to 26 in main.rs> before-string #(": " 0 1 (face eglot-type-hint-face cursor 1) 1 2 (face eglot-type-hint-face)))
1 <- overlay-put: #(": " 0 1 (face eglot-type-hint-face cursor 1) 1 2 (face eglot-type-hint-face))
======================================================================
1 -> (overlay-put #<overlay from 25 to 26 in main.rs> priority 0)
1 <- overlay-put: 0
======================================================================
1 -> (overlay-put #<overlay from 25 to 26 in main.rs> eglot--inlay-hint t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 25 to 26 in main.rs> evaporate t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 25 to 26 in main.rs> eglot--overlay t)
1 <- overlay-put: t
======================================================================
1 -> (make-overlay 25 26 nil t)
1 <- make-overlay: #<overlay from 25 to 26 in main.rs>
======================================================================
1 -> (overlay-put #<overlay from 25 to 26 in main.rs> before-string #("Vec" 0 3 (face eglot-type-hint-face)))
1 <- overlay-put: #("Vec" 0 3 (face eglot-type-hint-face))
======================================================================
1 -> (overlay-put #<overlay from 25 to 26 in main.rs> priority 1)
1 <- overlay-put: 1
======================================================================
1 -> (overlay-put #<overlay from 25 to 26 in main.rs> eglot--inlay-hint t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 25 to 26 in main.rs> evaporate t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 25 to 26 in main.rs> eglot--overlay t)
1 <- overlay-put: t
======================================================================
1 -> (make-overlay 25 26 nil t)
1 <- make-overlay: #<overlay from 25 to 26 in main.rs>
======================================================================
1 -> (overlay-put #<overlay from 25 to 26 in main.rs> before-string #("<i32>" 0 5 (face eglot-type-hint-face)))
1 <- overlay-put: #("<i32>" 0 5 (face eglot-type-hint-face))
======================================================================
1 -> (overlay-put #<overlay from 25 to 26 in main.rs> priority 2)
1 <- overlay-put: 2
======================================================================
1 -> (overlay-put #<overlay from 25 to 26 in main.rs> eglot--inlay-hint t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 25 to 26 in main.rs> evaporate t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 25 to 26 in main.rs> eglot--overlay t)
1 <- overlay-put: t
======================================================================
1 -> (make-overlay 51 52 nil nil nil)
1 <- make-overlay: #<overlay from 51 to 52 in main.rs>
======================================================================
1 -> (overlay-put #<overlay from 51 to 52 in main.rs> after-string #("index" 0 5 (face eglot-parameter-hint-face)))
1 <- overlay-put: #("index" 0 5 (face eglot-parameter-hint-face))
======================================================================
1 -> (overlay-put #<overlay from 51 to 52 in main.rs> priority 0)
1 <- overlay-put: 0
======================================================================
1 -> (overlay-put #<overlay from 51 to 52 in main.rs> eglot--inlay-hint t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 51 to 52 in main.rs> evaporate t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 51 to 52 in main.rs> eglot--overlay t)
1 <- overlay-put: t
======================================================================
1 -> (make-overlay 51 52 nil nil nil)
1 <- make-overlay: #<overlay from 51 to 52 in main.rs>
======================================================================
1 -> (overlay-put #<overlay from 51 to 52 in main.rs> after-string #(": " 0 2 (face eglot-parameter-hint-face)))
1 <- overlay-put: #(": " 0 2 (face eglot-parameter-hint-face))
======================================================================
1 -> (overlay-put #<overlay from 51 to 52 in main.rs> priority 1)
1 <- overlay-put: 1
======================================================================
1 -> (overlay-put #<overlay from 51 to 52 in main.rs> eglot--inlay-hint t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 51 to 52 in main.rs> evaporate t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 51 to 52 in main.rs> eglot--overlay t)
1 <- overlay-put: t
======================================================================
1 -> (make-overlay 53 54 nil nil nil)
1 <- make-overlay: #<overlay from 53 to 54 in main.rs>
======================================================================
1 -> (overlay-put #<overlay from 53 to 54 in main.rs> after-string #("element" 0 7 (face eglot-parameter-hint-face)))
1 <- overlay-put: #("element" 0 7 (face eglot-parameter-hint-face))
======================================================================
1 -> (overlay-put #<overlay from 53 to 54 in main.rs> priority 0)
1 <- overlay-put: 0
======================================================================
1 -> (overlay-put #<overlay from 53 to 54 in main.rs> eglot--inlay-hint t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 53 to 54 in main.rs> evaporate t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 53 to 54 in main.rs> eglot--overlay t)
1 <- overlay-put: t
======================================================================
1 -> (make-overlay 53 54 nil nil nil)
1 <- make-overlay: #<overlay from 53 to 54 in main.rs>
======================================================================
1 -> (overlay-put #<overlay from 53 to 54 in main.rs> after-string #(": " 0 2 (face eglot-parameter-hint-face)))
1 <- overlay-put: #(": " 0 2 (face eglot-parameter-hint-face))
======================================================================
1 -> (overlay-put #<overlay from 53 to 54 in main.rs> priority 1)
1 <- overlay-put: 1
======================================================================
1 -> (overlay-put #<overlay from 53 to 54 in main.rs> eglot--inlay-hint t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 53 to 54 in main.rs> evaporate t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 53 to 54 in main.rs> eglot--overlay t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 176 to 177 in *ielm*> priority 1000)
1 <- overlay-put: 1000
======================================================================
1 -> (overlay-put #<overlay from 176 to 177 in *ielm*> face show-paren-match)
1 <- overlay-put: show-paren-match
======================================================================
1 -> (overlay-put #<overlay from 164 to 165 in *ielm*> priority 1000)
1 <- overlay-put: 1000
======================================================================
1 -> (overlay-put #<overlay from 164 to 165 in *ielm*> face show-paren-match)
1 <- overlay-put: show-paren-match
> On 19. 6. 2023., at 21:08, João Távora <joaotavora@gmail.com> wrote:
>
> On Mon, Jun 19, 2023 at 7:06 PM Milan Jovanovic <milanj@gmail.com> wrote:
>
>> So, you fix did solve original Krzysztof report (and my original report) for more complex type hints but now I have the same issue with argument hints.
>
> Yes, and I've already replied to you that I can't reproduce
> your error. So maybe you should follow the instructions
> of
>
> https://joaotavora.github.io/eglot/#Troubleshooting-Eglot
>
> so that you can provide a bullet-proof reproduction recipe.
>
> So far, you haven't done that. You just send me snippets of
> Rust code and I assume I should paste them into my own
> Emacs. And there, I can't reproduce the problem.
>
> IOW, I don't doubt that there's a problem in Eglot, but I
> need you to patiently craft a mail with the full recipe, i.e.
> the fullest -- and simplest -- account possible of your
> problem.
>
>> Example:
>>
>> fn main () {
>> let mut c = vec![1,2,3];
>> c.insert(0, 0);
>> }
>>
>
> Here, again, I see the correct inlay hints.
>
> Here's my recipe.
>
> $ cd /tmp
> $ cargo new bla
> $ cd bla
> $ rust-analyzer --version
> rust-analyzer 1 (cd3bf9fe51 2023-06-18)
> $ emacs --version
> ~/Source/Emacs/emacs/src/emacs --version
> GNU Emacs 30.0.50
> Development version 075e77ac4493 on master branch; build date 2023-06-19.
> ...
> <actually I have eglot.el patched with the latest patch>
> $ emacs -Q -f package-initialize src/main.rs -f eglot
>
> Now I wait a little bit for the connection to stabilize and then type in your
> main.rs content. If the inlay hints don't immediately appear, just add and
> delete a character anywhere in the buffer. When they do appear, they appear
> correctly.
>
> My rust-mode.el is version 1.0.5, but I've tried successfully with rust-ts-mode
> as well.
>
> And by the way, this is the trace of the make-overlay and overlay-put
> functions
>
> ======================================================================
> 1 -> (make-overlay 53 54 nil nil nil)
> 1 <- make-overlay: #<overlay from 53 to 54 in main.rs>
> ======================================================================
> 1 -> (overlay-put #<overlay from 53 to 54 in main.rs> after-string
> #("index: " 0 7 (face eglot-parameter-hint-face)))
> 1 <- overlay-put: #("index: " 0 7 (face eglot-parameter-hint-face))
> ======================================================================
> 1 -> (overlay-put #<overlay from 53 to 54 in main.rs> priority 0)
> 1 <- overlay-put: 0
> ======================================================================
> 1 -> (overlay-put #<overlay from 53 to 54 in main.rs> eglot--inlay-hint t)
> 1 <- overlay-put: t
> ======================================================================
> 1 -> (overlay-put #<overlay from 53 to 54 in main.rs> evaporate t)
> 1 <- overlay-put: t
> ======================================================================
> 1 -> (overlay-put #<overlay from 53 to 54 in main.rs> eglot--overlay t)
> 1 <- overlay-put: t
> ======================================================================
> 1 -> (make-overlay 56 57 nil nil nil)
> 1 <- make-overlay: #<overlay from 56 to 57 in main.rs>
> ======================================================================
> 1 -> (overlay-put #<overlay from 56 to 57 in main.rs> after-string
> #("element: " 0 9 (face eglot-parameter-hint-face)))
> 1 <- overlay-put: #("element: " 0 9 (face eglot-parameter-hint-face))
> ======================================================================
> 1 -> (overlay-put #<overlay from 56 to 57 in main.rs> priority 0)
> 1 <- overlay-put: 0
> ======================================================================
> 1 -> (overlay-put #<overlay from 56 to 57 in main.rs> eglot--inlay-hint t)
> 1 <- overlay-put: t
> ======================================================================
> 1 -> (overlay-put #<overlay from 56 to 57 in main.rs> evaporate t)
> 1 <- overlay-put: t
> ======================================================================
> 1 -> (overlay-put #<overlay from 56 to 57 in main.rs> eglot--overlay t)
> 1 <- overlay-put: t
>
> So, as you can see, the server isn't supplying different hints for
> "index" and ":". So I can't reproduce your error, you must be
> using a different version of rust analyzer or something like that.
>
> This is the relevant portion of my Eglot events buffer:
>
> (:jsonrpc "2.0" :id 39 :result
> [(:position (:line 1 :character 12) :label
> [(:value ": ")
> (:value "Vec" :location
> (:uri
>
> "file:///usr/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs"
> :range
> (:start (:line 395 :character 11) :end
> (:line 395 :character 14))))
> (:value "<i32>")]
> :kind 1 :textEdits
> [(:range
> (:start (:line 1 :character 12) :end
> (:line 1 :character 12))
> :newText ": Vec<i32>")]
> :paddingLeft :json-false :paddingRight
> :json-false)
> (:position (:line 2 :character 12) :label
> [(:value "index:" :location
> (:uri
>
> "file:///usr/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs"
> :range
> (:start (:line 1434 :character 29)
> :end
> (:line 1434 :character 34))))]
> :kind 2 :paddingLeft :json-false :paddingRight t)
> (:position (:line 2 :character 15) :label
> [(:value "element:" :location
> (:uri
>
> "file:///usr/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs"
> :range
> (:start (:line 1434 :character 43)
> :end
> (:line 1434 :character 50))))]
> :kind 2 :paddingLeft :json-false :paddingRight t)])
>
> João
next prev parent reply other threads:[~2023-06-19 21:05 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-15 21:23 bug#64101: 29.0.91; Eglot inlay hints rendered out of order Krzysztof Klimonda
2023-06-17 7:56 ` Eli Zaretskii
2023-06-17 9:39 ` João Távora
2023-06-17 10:41 ` Eli Zaretskii
2023-06-17 12:19 ` João Távora
2023-06-17 13:17 ` Eli Zaretskii
2023-06-17 13:26 ` João Távora
2023-06-17 14:12 ` Eli Zaretskii
2023-06-17 14:29 ` João Távora
2023-06-17 15:50 ` Eli Zaretskii
2023-06-17 16:45 ` João Távora
2023-06-17 12:26 ` Krzysztof Klimonda
2023-06-17 19:02 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-17 22:25 ` João Távora
2023-06-18 0:45 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-18 8:47 ` João Távora
2023-06-18 14:18 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-18 14:22 ` João Távora
2023-06-18 14:29 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-18 14:36 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-18 15:20 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-19 16:17 ` Milan Jovanovic
2023-06-19 16:34 ` João Távora
2023-06-19 18:06 ` Milan Jovanovic
2023-06-19 19:08 ` João Távora
2023-06-19 21:05 ` Milan Jovanovic [this message]
2023-06-19 22:38 ` João Távora
2023-06-20 11:10 ` Eli Zaretskii
2023-06-20 11:32 ` Milan Jovanovic
2023-06-20 12:01 ` Eli Zaretskii
2023-06-20 13:34 ` Milan Jovanovic
2023-06-20 13:46 ` Eli Zaretskii
2023-06-20 13:50 ` João Távora
2023-06-17 20:54 ` Milan Jovanovic
2023-06-17 22:35 ` João Távora
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=410CA10A-75BB-4F88-B974-E69E349B3064@gmail.com \
--to=milanj@gmail.com \
--cc=64101@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=joaotavora@gmail.com \
--cc=kklimonda@syntaxhighlighted.com \
--cc=monnier@iro.umontreal.ca \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.