Subject: bug#64101: 29.0.91; Eglot inlay hints rendered out of order

From: Milan Jovanovic <[email-masked]>
Date: Mon, 19 Jun 2023 20:06:47 +0200

> On 19. 6. 2023., at 18:34, João Távora <[email-masked]> wrote:
> 
> On Mon, Jun 19, 2023 at 5:17 PM Milan Jovanovic <[email-masked]> wrote:
>> 
>> João,  is there a reason why (in Eglot) hint parts can’t be merged and only one overlay created ?
> 
> Yes, in general you want to keep different properties of different
> labels, such as URL links isolated.
Not sure that I understand, I was talking about merging “values” of one “label”, I don’t see that inlay hints code is using any other property from response (other than :value)

>> I fix it to create one overlay and I haven’t noticed any issues (I use it only with the rust-analyzer though).
>> Don’t know if this is stupid question,  don’t know much about LSP protocol (or Emacs internals).
> 
> It's not a stupid question at all, and it's a possibility, but
> I have to understand the problem first, and if you haven't
> yet understood that, I don't have a Mac OS machine to test.
> 
> Before trying fixes, or at least while you're trying them,
> please I urge you to provide a reproduction recipe for whatever
> you're trying to do.  Your last follow-up bug report is completely strange
> to me: in the situation you last described there aren't any
> multiple coinciding overlays like in the original report of Krzysztof.
> 
> João

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.

Example:

fn main () {
   let mut c = vec![1,2,3];
   c.insert(0, 0);
}

Inlay type hint of “c” is ok but argument hints for insert() are presented in wrong order:

Instead of    "c.insert(‘index:’ 0, ‘element: ‘ 0)"
i’m getting   "c.insert(‘: index’0, ‘: element’0)”

Trace for this part:

1 -> (make-overlay 384 385 nil nil nil)
1 <- make-overlay: #<overlay from 384 to 385 in main.rs>
======================================================================
1 -> (overlay-put #<overlay from 384 to 385 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 384 to 385 in main.rs> priority 0)
1 <- overlay-put: 0
======================================================================
1 -> (overlay-put #<overlay from 384 to 385 in main.rs> eglot--inlay-hint t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 384 to 385 in main.rs> evaporate t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 384 to 385 in main.rs> eglot--overlay t)
1 <- overlay-put: t
======================================================================
1 -> (make-overlay 384 385 nil nil nil)
1 <- make-overlay: #<overlay from 384 to 385 in main.rs>
======================================================================
1 -> (overlay-put #<overlay from 384 to 385 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 384 to 385 in main.rs> priority 1)
1 <- overlay-put: 1
======================================================================
1 -> (overlay-put #<overlay from 384 to 385 in main.rs> eglot--inlay-hint t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 384 to 385 in main.rs> evaporate t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 384 to 385 in main.rs> eglot--overlay t)
1 <- overlay-put: t
======================================================================
1 -> (make-overlay 387 388 nil nil nil)
1 <- make-overlay: #<overlay from 387 to 388 in main.rs>
======================================================================
1 -> (overlay-put #<overlay from 387 to 388 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 387 to 388 in main.rs> priority 0)
1 <- overlay-put: 0
======================================================================
1 -> (overlay-put #<overlay from 387 to 388 in main.rs> eglot--inlay-hint t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 387 to 388 in main.rs> evaporate t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 387 to 388 in main.rs> eglot--overlay t)
1 <- overlay-put: t
======================================================================
1 -> (make-overlay 387 388 nil nil nil)
1 <- make-overlay: #<overlay from 387 to 388 in main.rs>
======================================================================
1 -> (overlay-put #<overlay from 387 to 388 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 387 to 388 in main.rs> priority 1)
1 <- overlay-put: 1
======================================================================
1 -> (overlay-put #<overlay from 387 to 388 in main.rs> eglot--inlay-hint t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 387 to 388 in main.rs> evaporate t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 387 to 388 in main.rs> eglot--overlay t)
1 <- overlay-put: t
======================================================================
1 -> (make-overlay 517 518 nil t)
1 <- make-overlay: #<overlay from 517 to 518 in main.rs>
======================================================================
1 -> (overlay-put #<overlay from 517 to 518 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 517 to 518 in main.rs> priority 0)
1 <- overlay-put: 0
======================================================================
1 -> (overlay-put #<overlay from 517 to 518 in main.rs> eglot--inlay-hint t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 517 to 518 in main.rs> evaporate t)
1 <- overlay-put: t
======================================================================
1 -> (overlay-put #<overlay from 517 to 518 in main.rs> eglot--overlay t)
1 <- overlay-put: t