change indentation strategy for sequences whose head is a keyword
assume that these are part of some internal structure of something that, in general looks like (#:x 1 #:y 2 #:z 3) and so prefer to indent like this: (#:x 1 #:y 2 #:z 3) instead of like this: (#:x 1 #:y 2 #:z 3)
This commit is contained in:
parent
be30bf721d
commit
ab063326fe
|
@ -702,6 +702,8 @@
|
||||||
(- id-end contains)
|
(- id-end contains)
|
||||||
0))
|
0))
|
||||||
(cond
|
(cond
|
||||||
|
[(first-sexp-is-keyword? contains)
|
||||||
|
(visual-offset contains)]
|
||||||
[(second-sexp-is-ellipsis? contains)
|
[(second-sexp-is-ellipsis? contains)
|
||||||
(visual-offset contains)]
|
(visual-offset contains)]
|
||||||
[(not (find-up-sexp pos))
|
[(not (find-up-sexp pos))
|
||||||
|
@ -739,6 +741,13 @@
|
||||||
(not (= (position-paragraph thrd-start)
|
(not (= (position-paragraph thrd-start)
|
||||||
(position-paragraph snd-start)))))))))))))
|
(position-paragraph snd-start)))))))))))))
|
||||||
|
|
||||||
|
(define/private (first-sexp-is-keyword? contains)
|
||||||
|
(let ([fst-end (get-forward-sexp contains)])
|
||||||
|
(and fst-end
|
||||||
|
(let ([fst-start (get-backward-sexp fst-end)])
|
||||||
|
(and fst-start
|
||||||
|
(equal? (classify-position fst-start) 'hash-colon-keyword))))))
|
||||||
|
|
||||||
(define/public (tabify-selection [start-pos (get-start-position)]
|
(define/public (tabify-selection [start-pos (get-start-position)]
|
||||||
[end-pos (get-end-position)])
|
[end-pos (get-end-position)])
|
||||||
(unless (is-stopped?)
|
(unless (is-stopped?)
|
||||||
|
|
|
@ -171,6 +171,10 @@
|
||||||
"(r a\n b\n c\n d\n e\n f\n g")
|
"(r a\n b\n c\n d\n e\n f\n g")
|
||||||
(test-indentation "(r a b\nc d\ne f\ng h"
|
(test-indentation "(r a b\nc d\ne f\ng h"
|
||||||
"(r a b\n c d\n e f\n g h")
|
"(r a b\n c d\n e f\n g h")
|
||||||
|
(test-indentation "(#:x\n1)"
|
||||||
|
"(#:x\n 1)")
|
||||||
|
(test-indentation "(#:x 0\n1)"
|
||||||
|
"(#:x 0\n 1)")
|
||||||
|
|
||||||
|
|
||||||
(define (test-magic-square-bracket which before after)
|
(define (test-magic-square-bracket which before after)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user