start indenter

dev-srcloc
Matthew Butterick 8 years ago
parent dd67b321d5
commit 4a195ef050

@ -1,12 +1,9 @@
#lang br #lang br
(require racket/class) (require racket/class describe)
(provide drracket-indenter) (provide drracket-indenter)
(define (drracket-indenter t pos) (define (drracket-indenter txt pos)
#;(with-handlers ([exn:fail? (λ(exn) #f)]) ; this function won't work until gui-lib 1.26 (define i (char->integer (send txt get-character pos)))
(send t compute-racket-amount-to-indent pos (λ(x) (if (zero? i)
(case x #f
[("with-pattern" "with-shared-id") 'lambda] i))
[("define-macro") 'define]
[else #f]))))
#f)

@ -1,7 +1,9 @@
#lang br/demo/jsonic #lang br/demo/jsonic
{ {
"string": @$(string-append "foo" "bar")$@, "string": @$(string-append "foo" "bar")$@,
{
"array": @$(range 5)$@, "array": @$(range 5)$@,
"object": @$(hash "k1" "valstring" (format "~a" 42) (hash "k1" (range 10) "k2" 42))$@ "object": @$(hash "k1" "valstring" (format "~a" 42) (hash "k1" (range 10) "k2" 42))$@
}
// "bar" : // "bar" :
} }

@ -28,9 +28,10 @@
(λ (key default) (λ (key default)
(case key (case key
[(color-lexer) [(color-lexer)
(really-dynamic-require 'br/demo/jsonic/drracket-lexer 'drracket-lexer (λ () #f))] (dynamic-require 'br/demo/jsonic/drracket-lexer 'drracket-lexer (λ () #f))]
[(drracket:indentation) [(drracket:indentation)
(really-dynamic-require 'br/demo/jsonic/drracket-indenter 'drracket-indenter (λ () #f))] (dynamic-require 'br/demo/jsonic/drracket-indenter 'drracket-indenter (λ () #f))
#;(really-dynamic-require 'scribble/private/indentation 'determine-spaces)]
[else default]))) [else default])))
(define (test-tokenize str) (define (test-tokenize str)

Loading…
Cancel
Save