branch: elpa/graphql-mode
commit 1125c2136df99caa4eaa69fbc6172cd061f24972
Author: Tim Shiu <[email protected]>
Commit: Tim Shiu <[email protected]>
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."