João Távora writes: > Elijah Gabe Pérez writes: > Your ideas are good, but did you test your patch thoroughly? I did, see > comments below. > >> (overlay-buffer eglot--suggestion-overlay)) >> - (overlay-get eglot--suggestion-overlay 'eglot--suggestion-tooltip))) >> + (eglot--mode-line-props >> + eglot-code-action-indicator >> + 'help-echo >> + `((mouse-1 >> + eglot-code-actions-at-mouse >> + ,(plist-get (aref (overlay-get eglot--suggestion-overlay 'eglot--actions) 0) :title))) >> + "Execute code actions at point\n"))) > > This removes the face from the mode-line indication and uses 'help-echo. > Probably should be eglot-code-action-indicator-face. Oops, sorry, I thought that function was a kind of `propertize'. > Also the blurb looks like. > > Execute code actions at point. mouse-1: extract subexpression to variable > > Maybe it should be: > > mouse-1: execute code actions at point > > since your second sentence is misleading, as it will actually pop a > menu, not execute the actual action right away. I agree, fixed. >> (add-to-list >> @@ -4130,7 +4136,7 @@ eglot-code-action-suggestion >> (when (cl-plusp (length actions)) >> (setq blurb >> (substitute-command-keys >> - (eglot--format "\\[eglot-code-actions]: %s" >> + (eglot--format "\\[eglot-code-actions] or >> \\[eglot-code-actions-at-mouse]: %s" > > This isn't right, did you test this? The second part shows the user > instructions that when followed do not do what they say they do. For me > it says: > > or M-x eglot-code-actions-at-mouse: extract subexpression to variable > > I have M-x eglot-code-actions bound to of course. In my case it > should say 'mouse-2' as that is the (default) button that pops up a > menu. So it should be > > : extract subexpression to variable, mouse-2: execute code actions > at point > > Needless to say if I press 'M-x eglot-code-actions-at-mouse' it doesn't > work, and I get an error saying there is no mouse event when invoking > the command. So substitute-command-keys might not be a solution here, > as you can't easily get it to be aware of the special map and not say > anything if nothing is bound there. > > Even more problematic is the fact that it shows the changed blurb in the > ElDoc area, in situations where the mouse (if there even is one!) is not > hovering on the margin or fringe (if there even are fringes). > > So this isn't a straightforward problem to solve, which probably > explains why I left this minor detail out. > > I also feel that if the code to do this grows too complicated, it's > better to add generic utility to Emacs to solve these problems and > conditionally use it in eglot.el with a 'fboundp' check. A way I found for achieve this is only (re)propertizing the blurb help-echo for `margin' and `nearby' options (like the patch below). This let eldoc area unchanged (i tested it). I used `substitute-command-keys' only for get the mouse-1/2/3 button for margin, but since i see this is problematic, I've changed it to only display `mouse-2'. The help-echo for `margin' and `nearby' now should be displayed as: "M-x eglot-code-actions: remove #include directive (and 1 more actions), mouse-2: execute code actions at point" and for the mode-line: "mouse-1: Execute code actions at point."