Use a regular expression to indent for loops in framework

This commit is contained in:
Alexis King 2015-08-02 17:53:14 -07:00 committed by Robby Findler
parent e7399f2bcc
commit 63b27a8eeb
2 changed files with 11 additions and 3 deletions

View File

@ -415,8 +415,6 @@
splicing-letrec-syntaxes splicing-letrec-syntaxes+values
splicing-local splicing-syntax-parameterize
,@all-fors
do:
kernel-syntax-case
@ -447,7 +445,7 @@
type-case))
(preferences:set-default
'framework:tabify
(list defaults-ht #rx"^begin" #rx"^def" #f #f)
(list defaults-ht #rx"^begin" #rx"^def" #rx"^for\\*?(/|$)" #f)
(list/c (hash/c symbol? (or/c 'for/fold 'define 'begin 'lambda) #:flat? #t)
(or/c #f regexp?) (or/c #f regexp?) (or/c #f regexp?) (or/c #f regexp?)))

View File

@ -142,6 +142,16 @@
(test-indentation "(lambdaa (x)\nb)" "(lambdaa (x)\n b)")
(test-indentation "(define x\n (let/ec return\n (when 1\n (when 2\n\t\t 3))\n 2))"
"(define x\n (let/ec return\n (when 1\n (when 2\n 3))\n 2))")
(test-indentation "(for ([x 1])\nx)"
"(for ([x 1])\n x)")
(test-indentation "(for/list ([x 1])\nx)"
"(for/list ([x 1])\n x)")
(test-indentation "(for/anything ([x 1])\nx)"
"(for/anything ([x 1])\n x)")
(test-indentation "(for*/anything ([x 1])\nx)"
"(for*/anything ([x 1])\n x)")
(test-indentation "(for-anything ([x 1])\nx)"
"(for-anything ([x 1])\n x)")
(test-indentation "(for/fold ([x 1])\n([y 2])\n3\n4)"
"(for/fold ([x 1])\n ([y 2])\n 3\n 4)")
(test-indentation "a\na\na\n" "a\na\na\n")