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

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

[nongnu] elpa/graphql-mode 8b2fe76635 057/122: fix a recursive bug in gr


From: ELPA Syncer
Subject: [nongnu] elpa/graphql-mode 8b2fe76635 057/122: fix a recursive bug in graphql-current-operation
Date: Sat, 29 Jan 2022 08:03:32 -0500 (EST)

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

    fix a recursive bug in graphql-current-operation
---
 graphql-mode.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/graphql-mode.el b/graphql-mode.el
index 14ab2774a4..6fe9b7c731 100644
--- a/graphql-mode.el
+++ b/graphql-mode.el
@@ -127,12 +127,15 @@ of the variables used in the query."
     (if (not (equal start end))
        (buffer-substring-no-properties start end)
       (save-excursion
-       (let ((line (thing-at-point 'line t)))
+       (let ((saved-point (point))
+             (line (thing-at-point 'line t)))
          (when (string-match-p (regexp-quote "}") line)
-           (search-backward "}"))
+           (search-backward "}" (beginning-of-line)))
          (when (string-match-p (regexp-quote "{") line)
-           (search-forward "{"))
-         (graphql-current-query))))))
+           (search-forward "{" (end-of-line)))
+         (if (= (point) saved-point)
+             nil
+           (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]