dont use get-keyword-type as the parameter name
This commit is contained in:
parent
09519347e2
commit
af33c70558
|
@ -86,20 +86,20 @@
|
||||||
@defmethod[#:mode public-final
|
@defmethod[#:mode public-final
|
||||||
(compute-racket-amount-to-indent
|
(compute-racket-amount-to-indent
|
||||||
[pos exact-nonnegative-integer?]
|
[pos exact-nonnegative-integer?]
|
||||||
[get-keyword-type
|
[get-head-sexp-type
|
||||||
(-> string? (or/c #f 'lambda 'define 'begin 'for/fold 'other))
|
(-> string? (or/c #f 'lambda 'define 'begin 'for/fold 'other))
|
||||||
(λ (x) #f)])
|
(λ (x) #f)])
|
||||||
exact-nonnegative-integer?]{
|
exact-nonnegative-integer?]{
|
||||||
Computes the amount of space to indent the line containing @racket[pos],
|
Computes the amount of space to indent the line containing @racket[pos],
|
||||||
using the default s-expression indentation strategy.
|
using the default s-expression indentation strategy.
|
||||||
|
|
||||||
The function @racket[get-keyword-type] is consulted for each symbol/keyword
|
The function @racket[get-head-sexp-type] is consulted for each symbol/keyword
|
||||||
that follows an open parenthesis. If it returns @racket[#f], then the
|
that follows an open parenthesis. If it returns @racket[#f], then the
|
||||||
user's preferences (from the @onscreen{Indenting} panel of the @onscreen{Editing}
|
user's preferences (from the @onscreen{Indenting} panel of the @onscreen{Editing}
|
||||||
panel in the preferences dialog) are used.
|
panel in the preferences dialog) are used.
|
||||||
|
|
||||||
@history[#:added "1.9"
|
@history[#:added "1.9"
|
||||||
#:changed "1.26" @list{Added the @racket[get-keyword-type] argument.}]
|
#:changed "1.26" @list{Added the @racket[get-head-sexp-type] argument.}]
|
||||||
}
|
}
|
||||||
|
|
||||||
@defmethod[#:mode augment
|
@defmethod[#:mode augment
|
||||||
|
|
|
@ -564,15 +564,15 @@
|
||||||
tab-char?))
|
tab-char?))
|
||||||
(define/pubment (compute-amount-to-indent pos)
|
(define/pubment (compute-amount-to-indent pos)
|
||||||
(inner (compute-racket-amount-to-indent pos) compute-amount-to-indent pos))
|
(inner (compute-racket-amount-to-indent pos) compute-amount-to-indent pos))
|
||||||
(define/public-final (compute-racket-amount-to-indent pos [_get-keyword-type (λ (x) #f)])
|
(define/public-final (compute-racket-amount-to-indent pos [_get-head-sexp-type (λ (x) #f)])
|
||||||
(cond
|
(cond
|
||||||
[(is-stopped?) #f]
|
[(is-stopped?) #f]
|
||||||
[else
|
[else
|
||||||
(define get-keyword-type
|
(define get-head-sexp-type
|
||||||
(let ([tabify-prefs (preferences:get 'framework:tabify)])
|
(let ([tabify-prefs (preferences:get 'framework:tabify)])
|
||||||
(λ (text)
|
(λ (text)
|
||||||
(or (_get-keyword-type text)
|
(or (_get-head-sexp-type text)
|
||||||
(get-keyword-type-from-prefs text tabify-prefs)))))
|
(get-head-sexp-type-from-prefs text tabify-prefs)))))
|
||||||
(define last-pos (last-position))
|
(define last-pos (last-position))
|
||||||
(define para (position-paragraph pos))
|
(define para (position-paragraph pos))
|
||||||
(define is-tabbable?
|
(define is-tabbable?
|
||||||
|
@ -631,7 +631,7 @@
|
||||||
(let ([text (get-text contains id-end)])
|
(let ([text (get-text contains id-end)])
|
||||||
(cond
|
(cond
|
||||||
[(member (classify-position contains) '(keyword symbol))
|
[(member (classify-position contains) '(keyword symbol))
|
||||||
(get-keyword-type text)]
|
(get-head-sexp-type text)]
|
||||||
[else
|
[else
|
||||||
'other]))))
|
'other]))))
|
||||||
(define (procedure-indent)
|
(define (procedure-indent)
|
||||||
|
@ -1369,7 +1369,7 @@
|
||||||
(cond
|
(cond
|
||||||
[(and (eq? type 'symbol)
|
[(and (eq? type 'symbol)
|
||||||
(string? lexeme)
|
(string? lexeme)
|
||||||
(get-keyword-type-from-prefs lexeme tabify-pref))
|
(get-head-sexp-type-from-prefs lexeme tabify-pref))
|
||||||
(values lexeme 'keyword paren start end backup-delta new-mode)]
|
(values lexeme 'keyword paren start end backup-delta new-mode)]
|
||||||
[else
|
[else
|
||||||
(values lexeme type paren start end backup-delta new-mode)]))
|
(values lexeme type paren start end backup-delta new-mode)]))
|
||||||
|
@ -1388,9 +1388,9 @@
|
||||||
(|[| |]|)
|
(|[| |]|)
|
||||||
(|{| |}|))))))
|
(|{| |}|))))))
|
||||||
|
|
||||||
;; get-keyword-type-from-prefs : string (list ht regexp regexp regexp)
|
;; get-head-sexp-type-from-prefs : string (list ht regexp regexp regexp)
|
||||||
;; -> (or/c #f 'lambda 'define 'begin 'for/fold)
|
;; -> (or/c #f 'lambda 'define 'begin 'for/fold)
|
||||||
(define (get-keyword-type-from-prefs text pref)
|
(define (get-head-sexp-type-from-prefs text pref)
|
||||||
(define ht (car pref))
|
(define ht (car pref))
|
||||||
(define beg-reg (list-ref pref 1))
|
(define beg-reg (list-ref pref 1))
|
||||||
(define def-reg (list-ref pref 2))
|
(define def-reg (list-ref pref 2))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user