GNU bug report logs -
#78106
[Feature Request] EGLOT: Optionally make code action indications use mouse clicks
Previous Next
Reported by: João Távora <joaotavora <at> gmail.com>
Date: Mon, 28 Apr 2025 07:22:01 UTC
Severity: wishlist
Done: João Távora <joaotavora <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Elijah Gabe Pérez <eg642616 <at> gmail.com> writes:
> João Távora <joaotavora <at> gmail.com> writes:
> It's used only for nearby and margin options:
Yes, and that's where it needs fixing, so no need for a second variable.
>>> + ,tooltip-1)))))
> ^
>>> (setq eglot--suggestion-overlay ov)))))
>
> Thus, Eldoc will not display "mouse-2: execute code actions at point",
> which can be confusing.
Perhaps, but it's even more confusing that if displays that blurb and
the mouse cursor is nowhere near, or there isn't a mouse cursor at all.
> For now i think that the hardcoded mouse-2 would be the best choice,
> also I've seen in other packages (including built-in) that they does the
> same.
I suppose. In fact it's better to have mouse-1, not mouse-2, for the
margin and mode-line, so I changed that. The reason we use mouse-2 for
in-buffer diagnostics overlays is because it's bad practice to rebind
mouse-1 there, whose meaning in an editable buffer should always be
"place point here".
>> (add-to-list
>> @@ -4146,14 +4150,13 @@ eglot-code-action-suggestion
>> (setq tooltip
>> (propertize eglot-code-action-indicator
>> 'face 'eglot-code-action-indicator-face
>> - 'help-echo blurb
>> + 'help-echo "mouse-2: execute code actions at point"
>
> "mouse-2: execute code actions at point" will appear also in ElDoc.
How? I don't see that happening in my testing.
>> 'mouse-face 'highlight
>> 'keymap eglot-diagnostics-map))
>> (save-excursion
>> (goto-char (car bounds))
>> (let ((ov (make-overlay (car bounds) (cadr bounds))))
>> (overlay-put ov 'eglot--actions actions)
>> - (overlay-put ov 'eglot--suggestion-tooltip tooltip)
>
> What was 'eglot--suggestion-tooltip' used for? Are you sure it should be
> removed?
I'm fairly sure. It's an internal symbol (as per the '--') and I didn't
catch any references to it. Some left over of the original implementation.
See patch after my sig. If you're content, I can push it:
João
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 474245352d6..d33b0b05fd4 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2531,7 +2531,11 @@ eglot-mode-line-action-suggestion
'(:eval
(when (and (memq 'mode-line eglot-code-action-indications)
(overlay-buffer eglot--suggestion-overlay))
- (overlay-get eglot--suggestion-overlay 'eglot--suggestion-tooltip)))
+ (eglot--mode-line-props
+ eglot-code-action-indicator 'eglot-code-action-indicator-face
+ `((mouse-1
+ eglot-code-actions-at-mouse
+ "execute code actions at point")))))
"Eglot mode line construct for at-point code actions.")
(add-to-list
@@ -2578,7 +2582,7 @@ eglot--diag-to-lsp-diag
(defvar eglot-diagnostics-map
(let ((map (make-sparse-keymap)))
(define-key map [mouse-2] #'eglot-code-actions-at-mouse)
- (define-key map [left-margin mouse-2] #'eglot-code-actions-at-mouse)
+ (define-key map [left-margin mouse-1] #'eglot-code-actions-at-mouse)
map)
"Keymap active in Eglot-backed Flymake diagnostic overlays.")
@@ -4146,14 +4150,13 @@ eglot-code-action-suggestion
(setq tooltip
(propertize eglot-code-action-indicator
'face 'eglot-code-action-indicator-face
- 'help-echo blurb
+ 'help-echo "mouse-1: execute code actions at point"
'mouse-face 'highlight
'keymap eglot-diagnostics-map))
(save-excursion
(goto-char (car bounds))
(let ((ov (make-overlay (car bounds) (cadr bounds))))
(overlay-put ov 'eglot--actions actions)
- (overlay-put ov 'eglot--suggestion-tooltip tooltip)
(overlay-put
ov
'before-string
This bug report was last modified 13 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.