branch: externals/eglot
commit 03fc783c4b701fc8c19096b7167b73bd5d8f63a8
Author: João Távora <[email protected]>
Commit: João Távora <[email protected]>
Per #895: Use bounds of thing at point when asking for code actions
* eglot.el (eglot--region-bounds): Consider bounds of things at
point.
---
eglot.el | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/eglot.el b/eglot.el
index daf6c3e237..83a2945514 100644
--- a/eglot.el
+++ b/eglot.el
@@ -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.