Skip to content

Commit

Permalink
Per #895: Use bounds of thing at point when asking for code actions
Browse files Browse the repository at this point in the history
* eglot.el (eglot--region-bounds): Consider bounds of things at
point.
  • Loading branch information
joaotavora committed Mar 24, 2022
1 parent afe2e11 commit 03fc783
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions eglot.el
Original file line number Diff line number Diff line change
Expand Up @@ -2838,8 +2838,11 @@ is not active."
:newName ,newname))
current-prefix-arg))

(defun eglot--region-bounds () "Region bounds if active, else point and nil."
(if (use-region-p) `(,(region-beginning) ,(region-end)) `(,(point) nil)))
(defun eglot--region-bounds ()
"Region bounds if active, else bounds of things at point."
(if (use-region-p) `(,(region-beginning) ,(region-end))
(let ((boftap (bounds-of-thing-at-point 'sexp)))
(list (car boftap) (cdr boftap)))))

(defun eglot-code-actions (beg &optional end action-kind)
"Offer to execute actions of ACTION-KIND between BEG and END.
Expand Down

0 comments on commit 03fc783

Please sign in to comment.