File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -157,10 +157,8 @@ Please install it and try again."))
157
157
(defun graphql-beginning-of-query ()
158
158
" Move the point to the beginning of the current query."
159
159
(interactive )
160
- (while (and (> (point ) (point-min ))
161
- (or (> (current-indentation ) 0 )
162
- (> (car (syntax-ppss )) 0 )))
163
- (forward-line -1 )))
160
+ (goto-char (syntax-ppss-toplevel-pos (syntax-ppss (point-at-bol ))))
161
+ (back-to-indentation ))
164
162
165
163
(defun graphql-end-of-query ()
166
164
" Move the point to the end of the current query."
@@ -312,15 +310,20 @@ Please install it and try again."))
312
310
(defun graphql-indent-line ()
313
311
" Indent GraphQL schema language."
314
312
(let ((position (point ))
313
+ (column)
315
314
(indent-pos))
315
+ (save-excursion
316
+ (graphql-beginning-of-query)
317
+ (setq column (current-column )))
318
+
316
319
(save-excursion
317
320
(let ((level (car (syntax-ppss (point-at-bol )))))
318
321
319
322
; ; Handle closing pairs
320
323
(when (looking-at " \\ s-*\\ s)" )
321
324
(setq level (1- level)))
322
325
323
- (indent-line-to (* graphql-indent-level level))
326
+ (indent-line-to (+ column ( * graphql-indent-level level) ))
324
327
(setq indent-pos (point ))))
325
328
326
329
(when (< position indent-pos)
You can’t perform that action at this time.
0 commit comments