Making separate find-syntax-source-editor file.

svn: r10432
This commit is contained in:
Danny Yoo 2008-06-23 22:15:35 +00:00
parent 6965dfd86c
commit d6ee81feba
3 changed files with 35 additions and 27 deletions

View File

@ -16,6 +16,7 @@ profile todo:
scheme/gui/base
string-constants
framework/private/bday
"find-syntax-source-editor.ss"
"drsig.ss"
"bindings-browser.ss"
(for-syntax scheme/base))
@ -775,7 +776,8 @@ profile todo:
[(and frame (is-a? frame frame:editor<%>))
(send frame get-editor)]
[else #f])]
[(is-a? debug-source editor<%>) debug-source])]
[(is-a? debug-source editor<%>) debug-source]
[else #f])]
[rep (and (is-a? frame drscheme:unit:frame%)
(send frame get-interactions-text))])
(when frame

View File

@ -0,0 +1,30 @@
#lang scheme/base
(require scheme/class
framework
scheme/gui/base)
(provide find-syntax-source-editor)
;; find-syntax-source-editor: syntax-source text% -> (or/c editor #f)
;; Looks for an embedded snip editor whose source is the a-stx-source.
;;
;; Note: this is a copy-and-paste from syncheck.
;; I've ripping out the editor caches for now,
;; until I get comments from others about this.
(define (find-syntax-source-editor a-stx-source defs-text)
(let txt-loop ([text defs-text])
(cond
[(and (is-a? text text:basic<%>)
(send text port-name-matches? a-stx-source))
text]
[else
(let snip-loop ([snip (send text find-first-snip)])
(cond
[(not snip)
#f]
[(and (is-a? snip editor-snip%)
(send snip get-editor))
(or (txt-loop (send snip get-editor))
(snip-loop (send snip next)))]
[else
(snip-loop (send snip next))]))])))

View File

@ -26,6 +26,7 @@ TODO
scheme/unit
scheme/list
"drsig.ss"
"find-syntax-source-editor.ss"
string-constants
setup/xref
scheme/gui/base
@ -707,7 +708,7 @@ TODO
(srcloc-column srcloc)
(srcloc-position srcloc)
(srcloc-span srcloc))]
[(find-source-editor (srcloc-source srcloc) definitions-text)
[(find-syntax-source-editor (srcloc-source srcloc) definitions-text)
=>
(lambda (editor)
(make-srcloc editor
@ -776,31 +777,6 @@ TODO
;; find-source-editor: syntax-source text% -> (or/c editor #f)
;; Looks for an embedded snip editor whose source is the a-stx-source.
;;
;; Note: this is a copy-and-paste from syncheck.
;; I've ripping out the editor caches for now,
;; until I get comments from others about this.
(define/private (find-source-editor a-stx-source defs-text)
(let txt-loop ([text defs-text])
(cond
[(and (is-a? text text:basic<%>)
(send text port-name-matches? a-stx-source))
text]
[else
(let snip-loop ([snip (send text find-first-snip)])
(cond
[(not snip)
#f]
[(and (is-a? snip editor-snip%)
(send snip get-editor))
(or (txt-loop (send snip get-editor))
(snip-loop (send snip next)))]
[else
(snip-loop (send snip next))]))])))
(define/public (reset-highlighting)
(reset-error-ranges))