Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outline for syncheck:add-arrow/name-dup/pxpy/renamable #417

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions drracket-test/tests/drracket/syncheck-test.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -1548,24 +1548,6 @@
" y`1\n"
" `2)\n"))

(build-rename-test
(string-append
"#lang racket\n"
"(require racket/list)\n")
14
"require"
#f
#f)

(build-rename-test
(string-append
"#lang racket\n"
"(require racket/list)\n")
20
"require"
#f
#f)

(build-test
#:extra-files
(hash "define-suffix.rkt"
Expand Down
48 changes: 37 additions & 11 deletions drracket-tool-doc/scribblings/drracket-tools/drracket-tools.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ that are exposed via Racket APIs to be used with other editors.
the vector are the arguments passed to the method.
(Note that this procedure does not account for the callback
procedures present in
@method[syncheck-annotations<%> syncheck:add-arrow/name-dup/pxpy]
and @method[syncheck-annotations<%> syncheck:add-id-set].)
@method[syncheck-annotations<%> syncheck:add-arrow/name-dup/pxpy/renamable].)

The @racket[file-or-stx] argument gives the input program
and @racket[fully-expanded?] indicates if the
Expand Down Expand Up @@ -207,7 +206,7 @@ in order to make the results be platform independent.
void?]{This method is no longer called by Check Syntax. It is here
for backwards compatibility only. The information it provided
must now be synthesized from the information supplied to
@method[syncheck-annotations<%> syncheck:add-arrow/name-dup/pxpy].}
@method[syncheck-annotations<%> syncheck:add-arrow/name-dup/pxpy/renamable].}

@defmethod[(syncheck:add-arrow [start-source-obj (not/c #f)]
[start-left exact-nonnegative-integer?]
Expand All @@ -219,7 +218,7 @@ in order to make the results be platform independent.
[phase-level (or/c exact-nonnegative-integer? #f)])
void?]{
This function is not called directly anymore by Check Syntax. Instead
@method[syncheck-annotations<%> syncheck:add-arrow/name-dup/pxpy] is.
@method[syncheck-annotations<%> syncheck:add-arrow/name-dup/pxpy/renamable] is.

This method is invoked by the default implementation of
@racket[_syncheck:add-arrow/name-dup] in
Expand All @@ -237,11 +236,11 @@ in order to make the results be platform independent.
[name-dup? (-> string? boolean?)])
void?]{
This function is not called directly anymore by Check Syntax. Instead
@method[syncheck-annotations<%> syncheck:add-arrow/name-dup/pxpy] is.
@method[syncheck-annotations<%> syncheck:add-arrow/name-dup/pxpy/renamable] is.

The default implementation of @method[syncheck-annotations<%> syncheck:add-arrow/name-dup/pxpy]
discards the @racket[_start-px] @racket[_start-py] @racket[_end-px] @racket[_end-py]
arguments and calls this method.
This method is invoked by the default implementation of
@racket[_syncheck:add-arrow/name-dup/pxpy] in
@racket[annotations-mixin].
}
@defmethod[(syncheck:add-arrow/name-dup/pxpy [start-source-obj (not/c #f)]
[start-left exact-nonnegative-integer?]
Expand All @@ -258,6 +257,29 @@ in order to make the results be platform independent.
[require-arrow (or/c boolean? 'module-lang-require)]
[name-dup? (-> string? boolean?)])
void?]{
This function is not called directly anymore by Check Syntax. Instead
@method[syncheck-annotations<%> syncheck:add-arrow/name-dup/pxpy/renamable] is.

This method is invoked by the default implementation of
@racket[_syncheck:add-arrow/name-dup/pxpy/renamable] in
@racket[annotations-mixin].
}
@defmethod[(syncheck:add-arrow/name-dup/pxpy/renamable
[start-source-obj (not/c #f)]
[start-left exact-nonnegative-integer?]
[start-right exact-nonnegative-integer?]
[start-px (real-in 0 1)]
[start-py (real-in 0 1)]
[end-source-obj (not/c #f)]
[end-left exact-nonnegative-integer?]
[end-right exact-nonnegative-integer?]
[end-px (real-in 0 1)]
[end-py (real-in 0 1)]
[actual? boolean?]
[phase-level (or/c exact-nonnegative-integer? #f)]
[require-arrow (or/c boolean? 'module-lang)]
[name-dup? (-> string? boolean?)])
void?]{
Called to indicate that there should be an arrow between the locations described by the first
ten arguments. The @racket[start-px] and @racket[start-py] indicate how far along the diagonal
between the upper-left coordinate of the editor position @racket[start-left] and the bottom-right
Expand Down Expand Up @@ -392,7 +414,10 @@ in order to make the results be platform independent.
@item{the @method[syncheck-annotations<%> syncheck:add-arrow/name-dup/pxpy]
method drops the @racket[_from-px], @racket[_from-py], @racket[_to-px],
and @racket[_to-py] arguments and calls
@method[syncheck-annotations<%> syncheck:add-arrow/name-dup]; and}
@method[syncheck-annotations<%> syncheck:add-arrow/name-dup]}
@item{the @method[syncheck-annotations<%> syncheck:add-arrow/name-dup/pxpy/renamable]
method drops the @racket[_renamable?] argument and calls
@method[syncheck-annotations<%> syncheck:add-arrow/name-dup/pxpy]; and}
@item{all of the other methods ignore their arguments and return @racket[(void)].}]

Here is an example showing how use this library to extract all
Expand All @@ -409,10 +434,10 @@ in order to make the results be platform independent.
(super-new)
(define/override (syncheck:find-source-object stx)
stx)
(define/override (syncheck:add-arrow/name-dup/pxpy
(define/override (syncheck:add-arrow/name-dup/pxpy/renamable
start-source-obj start-left start-right start-px start-py
end-source-obj end-left end-right end-px end-py
actual? phase-level require-arrow? name-dup?)
actual? phase-level require-arrow? name-dup? renamable?)
(set! arrows
(cons (list start-source-obj end-source-obj)
arrows)))
Expand Down Expand Up @@ -456,6 +481,7 @@ in order to make the results be platform independent.
syncheck:add-arrow
syncheck:add-arrow/name-dup
syncheck:add-arrow/name-dup/pxpy
syncheck:add-arrow/name-dup/pxpy/renamable
syncheck:add-tail-arrow
syncheck:add-mouse-over-status
syncheck:add-jump-to-definition
Expand Down
1 change: 1 addition & 0 deletions drracket-tool-lib/drracket/check-syntax.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
syncheck:add-arrow
syncheck:add-arrow/name-dup
syncheck:add-arrow/name-dup/pxpy
syncheck:add-arrow/name-dup/pxpy/renamable
syncheck:add-tail-arrow
syncheck:add-mouse-over-status
syncheck:add-jump-to-definition
Expand Down
15 changes: 15 additions & 0 deletions drracket-tool-lib/drracket/private/syncheck/syncheck-intf.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
syncheck:add-arrow
syncheck:add-arrow/name-dup
syncheck:add-arrow/name-dup/pxpy
syncheck:add-arrow/name-dup/pxpy/renamable
syncheck:add-tail-arrow
syncheck:add-mouse-over-status
syncheck:add-jump-to-definition
Expand Down Expand Up @@ -63,6 +64,20 @@
(syncheck:add-arrow/name-dup start-text start-pos-left start-pos-right
end-text end-pos-left end-pos-right
actual? level require-arrow? name-dup?))
(define/public (syncheck:add-arrow/name-dup/pxpy/renamable
start-text
start-pos-left start-pos-right
start-px start-py
end-text
end-pos-left end-pos-right
end-px end-py
actual? level require-arrow? name-dup? renamable?)
(syncheck:add-arrow/name-dup/pxpy
start-text start-pos-left start-pos-right
start-px start-py
end-text end-pos-left end-pos-right
end-px end-py
actual? level require-arrow? name-dup?))
(define/public (syncheck:add-tail-arrow from-text from-pos to-text to-pos) (void))
(define/public (syncheck:add-mouse-over-status text pos-left pos-right str) (void))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
syncheck:add-arrow
syncheck:add-arrow/name-dup
syncheck:add-arrow/name-dup/pxpy
syncheck:add-arrow/name-dup/pxpy/renamable
syncheck:add-rename-menu
syncheck:add-tail-arrow
syncheck:add-mouse-over-status
Expand Down
8 changes: 6 additions & 2 deletions drracket-tool-lib/drracket/private/syncheck/traversals.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -1144,10 +1144,14 @@
ans)
(when (and (<= from-pos-left from-pos-right)
(<= to-pos-left to-pos-right))
(send defs-text syncheck:add-arrow/name-dup/pxpy
(define renamable?
(not (or require-arrow?
(syntax-property to 'inhibit-renaming?)
(syntax-property from 'inhibit-renaming?))))
(send defs-text syncheck:add-arrow/name-dup/pxpy/renamable
from-source from-pos-left from-pos-right from-dx from-dy
to-source to-pos-left to-pos-right to-dx to-dy
actual? level require-arrow? name-dup?))]
actual? level require-arrow? name-dup? renamable?))]
[else
(unless (hash-ref connections connections-key #f)
(hash-set! connections connections-key #t)
Expand Down
Loading