start indenter

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

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

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

@ -28,9 +28,10 @@
(λ (key default)
(case key
[(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)
(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])))
(define (test-tokenize str)

Loading…
Cancel
Save