Skip to content

Commit 852d50e

Browse files
Eglot: bind mouse-1 to margin and mode-line code actions
* lisp/progmodes/eglot.el (eglot-mode-line-action-suggestion): advertise mouse-1. (eglot-diagnostics-map): Bind left-margin mouse-1 (eglot-code-action-suggestion): Advertise mouse 1. Simplify. Co-authored-by: João Távora <[email protected]>
1 parent a64a56f commit 852d50e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lisp/progmodes/eglot.el

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2531,7 +2531,11 @@ still unanswered LSP requests to the server\n"))))
25312531
'(:eval
25322532
(when (and (memq 'mode-line eglot-code-action-indications)
25332533
(overlay-buffer eglot--suggestion-overlay))
2534-
(overlay-get eglot--suggestion-overlay 'eglot--suggestion-tooltip)))
2534+
(eglot--mode-line-props
2535+
eglot-code-action-indicator 'eglot-code-action-indicator-face
2536+
`((mouse-1
2537+
eglot-code-actions-at-mouse
2538+
"execute code actions at point")))))
25352539
"Eglot mode line construct for at-point code actions.")
25362540

25372541
(add-to-list
@@ -2578,7 +2582,7 @@ still unanswered LSP requests to the server\n"))))
25782582
(defvar eglot-diagnostics-map
25792583
(let ((map (make-sparse-keymap)))
25802584
(define-key map [mouse-2] #'eglot-code-actions-at-mouse)
2581-
(define-key map [left-margin mouse-2] #'eglot-code-actions-at-mouse)
2585+
(define-key map [left-margin mouse-1] #'eglot-code-actions-at-mouse)
25822586
map)
25832587
"Keymap active in Eglot-backed Flymake diagnostic overlays.")
25842588

@@ -4146,14 +4150,13 @@ at point. With prefix argument, prompt for ACTION-KIND."
41464150
(setq tooltip
41474151
(propertize eglot-code-action-indicator
41484152
'face 'eglot-code-action-indicator-face
4149-
'help-echo blurb
4153+
'help-echo "mouse-1: execute code actions at point"
41504154
'mouse-face 'highlight
41514155
'keymap eglot-diagnostics-map))
41524156
(save-excursion
41534157
(goto-char (car bounds))
41544158
(let ((ov (make-overlay (car bounds) (cadr bounds))))
41554159
(overlay-put ov 'eglot--actions actions)
4156-
(overlay-put ov 'eglot--suggestion-tooltip tooltip)
41574160
(overlay-put
41584161
ov
41594162
'before-string

0 commit comments

Comments
 (0)