branch: elpa/graphql-mode
commit 4d075a9cfd0cce7607cc31c0432d3599b6e7047e
Author: christopher floess <[email protected]>
Commit: christopher floess <[email protected]>

    Basic support for better indenting in polymode
---
 graphql-mode.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/graphql-mode.el b/graphql-mode.el
index 5f3ed0e161..19b584ee91 100644
--- a/graphql-mode.el
+++ b/graphql-mode.el
@@ -281,7 +281,14 @@ Please install it and try again."))
 (defun graphql-indent-line ()
   "Indent GraphQL schema language."
   (let ((position (point))
+        (column)
         (indent-pos))
+    (save-excursion
+      (while (> (car (syntax-ppss (point-at-bol))) 0)
+        (forward-line -1))
+      (back-to-indentation)
+      (setq column (current-column)))
+
     (save-excursion
       (let ((level (car (syntax-ppss (point-at-bol)))))
 
@@ -289,7 +296,7 @@ Please install it and try again."))
         (when (looking-at "\\s-*\\s)")
           (setq level (1- level)))
 
-        (indent-line-to (* graphql-indent-level level))
+        (indent-line-to (+ column (* graphql-indent-level level)))
         (setq indent-pos (point))))
 
     (when (< position indent-pos)

Reply via email to