emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/eglot2emacs 965e1378f1 053/120: Use bounds of thing at point whe


From: João Távora
Subject: feature/eglot2emacs 965e1378f1 053/120: Use bounds of thing at point when asking for code actions
Date: Thu, 20 Oct 2022 07:16:52 -0400 (EDT)

branch: feature/eglot2emacs
commit 965e1378f19d36284119324a06840752dfff3990
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Use bounds of thing at point when asking for code actions
    
    * eglot.el (eglot--region-bounds): Consider bounds of things at
    point.
    
    GitHub-reference: per https://github.com/joaotavora/eglot/issues/895
---
 lisp/progmodes/eglot.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index daf6c3e237..83a2945514 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]