GNU bug report logs - #64101
29.0.91; Eglot inlay hints rendered out of order

Previous Next

Package: emacs;

Reported by: Krzysztof Klimonda <kklimonda <at> syntaxhighlighted.com>

Date: Fri, 16 Jun 2023 05:57:04 UTC

Severity: normal

Found in version 29.0.91

Full log


View this message in rfc822 format

From: "Krzysztof Klimonda" <kklimonda <at> syntaxhighlighted.com>
To: João Távora <joaotavora <at> gmail.com>, "Eli Zaretskii" <eliz <at> gnu.org>
Cc: 64101 <at> debbugs.gnu.org
Subject: bug#64101: 29.0.91; Eglot inlay hints rendered out of order
Date: Sat, 17 Jun 2023 14:26:49 +0200
Hi Joao,

The attached patch has indeed fixed the issue.

Additionally, I've tested the behaviour on emacs 28.2 and the bug persists, so it seems to be unrelated to any overlay changes.

On Sat, Jun 17, 2023, at 11:39, João Távora wrote:
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>> João, are you looking into this?  
>
> I looked at a very similar issue: 
> https://github.com/joaotavora/eglot/discussions/1239
>
> There, Milan Jovanovic , reports something very similar,
> if not completely identical, for Emacs 29.  I asked
> Milan to send mail here.  Maybe Krzystof and Milan are
> related, or this is just a coincidence?
>
> Anyway, I tried to reproduce the problem on both Emacs 29
> and 30 and couldn't.
>
> The problem also doesn't happen on Emacs 28.  So I don't know what is up
> and the "recent overlay rewrite" (when?) doesn't seem to have an effect.
> I don't have a Mac OS machine to test.
>
>> Should the overlays created for the
>> inlay hints be forced to be sorted in some particular order?
>
> Maybe, and there is definitely an order they should be sorted.
> But as far as I can personally observe, there is no problem yet,
> so it would be best to first understand the problem.
>
> 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

-- 
  Krzysztof Klimonda
  kklimonda <at> syntaxhighlighted.com




This bug report was last modified 2 years and 61 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.