emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/graphql-mode 1125c2136d 055/122: extend graphql-current-op


From: ELPA Syncer
Subject: [nongnu] elpa/graphql-mode 1125c2136d 055/122: extend graphql-current-operation to support 'line' boundary if sexp fail
Date: Sat, 29 Jan 2022 08:03:32 -0500 (EST)

branch: elpa/graphql-mode
commit 1125c2136df99caa4eaa69fbc6172cd061f24972
Author: Tim Shiu <punshiu@fb.com>
Commit: Tim Shiu <punshiu@fb.com>

    extend graphql-current-operation to support 'line' boundary if sexp fail
---
 graphql-mode.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/graphql-mode.el b/graphql-mode.el
index 04720f27c4..67ebaba4eb 100644
--- a/graphql-mode.el
+++ b/graphql-mode.el
@@ -124,7 +124,15 @@ of the variables used in the query."
          (save-excursion
            (graphql-end-of-query)
            (point))))
-    (buffer-substring-no-properties start end)))
+    (if (not (equal start end))
+       (buffer-substring-no-properties start end)
+      (save-excursion
+       (let ((line (thing-at-point 'line t)))
+         (when (string-match-p (regexp-quote "}") line)
+           (beginning-of-line))
+         (when (string-match-p (regexp-quote "{") line)
+           (end-of-line))
+         (graphql-current-query))))))
 
 (defun graphql-current-operation ()
   "Return the name of the current graphql query."



reply via email to

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