bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Milan Jovanovic
Subject: bug#64101: 29.0.91; Eglot inlay hints rendered out of order
Date: Sat, 17 Jun 2023 22:54:32 +0200

Hi,
This fixes more complicated types that I had issue with but I’ve noticed that 
it now breaks this example:
let mut x = vec![1,2,3];
x.insert(1, 1) 
with type hints inserted => x.insert(: index0, : element1)

> But maybe Milan/Krzystof can try this patch:
>
> diff —git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
> index a65795f1dfc..0c000f72ec7 100644
> --- a/lisp/progmodes/eglot.el
> +++ b/lisp/progmodes/eglot.el
> @@ -3755,8 +3755,9 @@ eglot--update-hints-1
>                      (if peg-after-p
>                          (make-overlay (point) (1+ (point)) nil t)
>                        (make-overlay (1- (point)) (point) nil nil nil)))
> -                   (do-it (label lpad rpad firstp)
> -                     (let* ((tweak-cursor-p (and firstp peg-after-p))
> +                   (do-it (label lpad rpad i)
> +                     (let* ((firstp (zerop i))
> +                            (tweak-cursor-p (and firstp peg-after-p))
>                             (ov (make-ov))
>                             (text (concat lpad label rpad)))
>                        (when tweak-cursor-p (put-text-property 0 1 'cursor 1 
> text))
> @@ -3767,17 +3768,18 @@ eglot--update-hints-1
>                                              (1 'eglot-type-hint-face)
>                                              (2 'eglot-parameter-hint-face)
>                                              (_ 'eglot-inlay-hint-face))))
> +                       (overlay-put ov 'priority i)
>                        (overlay-put ov 'eglot--inlay-hint t)
>                        (overlay-put ov 'evaporate t)
>                        (overlay-put ov 'eglot--overlay t))))
> -                (if (stringp label) (do-it label left-pad right-pad t)
> +                (if (stringp label) (do-it label left-pad right-pad 0)
>                   (cl-loop
>                    for i from 0 for ldetail across label
>                    do (eglot--dbind ((InlayHintLabelPart) value) ldetail
>                         (do-it value
>                                (and (zerop i) left-pad)
>                                (and (= i (1- (length label))) right-pad)
> -                               (zerop i))))))))))
> +                               i)))))))))
>     (jsonrpc-async-request
>      (eglot--current-server-or-lose)
>      :textDocument/inlayHint








reply via email to

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