diff --git a/beautiful-racket/br/demo/jsonic/drracket-indenter.rkt b/beautiful-racket/br/demo/jsonic/drracket-indenter.rkt index 824d809..883a8e1 100644 --- a/beautiful-racket/br/demo/jsonic/drracket-indenter.rkt +++ b/beautiful-racket/br/demo/jsonic/drracket-indenter.rkt @@ -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) \ No newline at end of file +(define (drracket-indenter txt pos) + (define i (char->integer (send txt get-character pos))) + (if (zero? i) + #f + i)) \ No newline at end of file diff --git a/beautiful-racket/br/demo/jsonic/jsonic-test.rkt b/beautiful-racket/br/demo/jsonic/jsonic-test.rkt index 02ad6a4..d6082e3 100644 --- a/beautiful-racket/br/demo/jsonic/jsonic-test.rkt +++ b/beautiful-racket/br/demo/jsonic/jsonic-test.rkt @@ -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" : -} \ No newline at end of file + #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" : + } \ No newline at end of file diff --git a/beautiful-racket/br/demo/jsonic/main.rkt b/beautiful-racket/br/demo/jsonic/main.rkt index 5b227e6..ec42c92 100644 --- a/beautiful-racket/br/demo/jsonic/main.rkt +++ b/beautiful-racket/br/demo/jsonic/main.rkt @@ -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)