Subject: bug#78324: 31.0.50; [Eglot] help-echo in code action indator doesn't indicate if there are more code actions available

From: João Távora <[email-masked]>
Date: Fri, 09 May 2025 09:45:59 +0100

Elijah Gabe Pérez <[email-masked]> writes:

> After 852d50e commit, the help-echo in eglot code action indicator
> doesn't show the "(and %s more actions)".

That's right.  And that's by design (didn't you test and greelight the
patch of bug#78106)?
>
> I've also noticed that blurb was left unused.

Look again.  It's used for ElDoc, there's a

   (funcall cb blurb)

further down.

> Can be possible add also the actions available counter to help-echo?
> As shown in this patch:
>
> #+begin_src diff
> @@ -4145,12 +4151,13 @@ eglot-code-action-suggestion
>                      (eglot--format "\\[eglot-code-actions]: %s"
>                                     (plist-get (aref actions 0) :title))))
>               (if (>= (length actions) 2)
> -                 (setq blurb (concat blurb (format "(and %s more actions)"
> -                                                   (1- (length actions))))))
> +                 (setq blurb (format "(%s more actions available)"
> +                                     (1- (length actions)))))
>               (setq tooltip
>                     (propertize eglot-code-action-indicator
>                                 'face 'eglot-code-action-indicator-face
> -                               'help-echo "mouse-1: execute code actions at point"
> +                               'help-echo (concat "mouse-1: execute code actions at point"
> +                                                  "\n" blurb)

This would break the current uses ElDoc . And if I follow your
intention, it would still be wrong, as if 3 actions were present it
would say sth like:

  mouse-1: execute code actions at point
  (2 more actions available)

which doesn't make sense.

In my opinion, there is nothing to do here.  The richer blurb is only
meant for the ElDoc outlet, because that points to a specific non-mouse
binding which will immediately execute the singleton action at point or
offer a menu of all actions.  The mouse bindings always offer the menu.

João