Skip to content

Commit

Permalink
don't follow arrows that go through requires when doing renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
rfindler committed Sep 18, 2021
1 parent 11333f9 commit b344541
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 23 deletions.
21 changes: 9 additions & 12 deletions drracket-test/tests/drracket/syncheck-test.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -1552,20 +1552,17 @@
(build-rename-test
(string-append
"#lang racket\n"
"(require racket/list)\n")
14
"require"
#f
#f)

(build-rename-test
"(define cons 5)\n"
"(quote-syntax cons)\n"
"(define-syntax x #f)\n")
44
"cons"
"abc"
(string-append
"#lang racket\n"
"(require racket/list)\n")
20
"require"
#f
#f)
"(define abc 5)\n"
"(quote-syntax abc)\n"
"(define-syntax x #f)\n"))

(build-test
#:extra-files
Expand Down
18 changes: 7 additions & 11 deletions drracket/drracket/private/syncheck/gui.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,7 @@ If the namespace does not, they are colored the unbound color.
(define-values (binding-identifiers make-identifiers-hash)
(position->matching-identifiers-hash text
(send text get-start-position)
(send text get-end-position)
#t))
(send text get-end-position)))
(unless (null? binding-identifiers)
(define-values (name-to-offer description-of-name)
(find-name-to-offer binding-identifiers
Expand Down Expand Up @@ -1534,7 +1533,7 @@ If the namespace does not, they are colored the unbound color.
(f menu))

(define-values (binding-identifiers make-identifiers-hash)
(position->matching-identifiers-hash text pos pos #t))
(position->matching-identifiers-hash text pos pos))
(unless (null? binding-identifiers)
(define-values (name-to-offer description-of-name)
(find-name-to-offer binding-identifiers pos pos))
Expand Down Expand Up @@ -1600,8 +1599,7 @@ If the namespace does not, they are colored the unbound color.
(cond
[(and cursor-text cursor-pos)
(define-values (binders make-identifiers-hash)
(position->matching-identifiers-hash cursor-text cursor-pos cursor-pos
#f))
(position->matching-identifiers-hash cursor-text cursor-pos cursor-pos))
(make-identifiers-hash)]
[else
(make-hash)]))
Expand All @@ -1613,12 +1611,10 @@ If the namespace does not, they are colored the unbound color.

;; position->matching-identifiers-hash
;; : txt pos pos -> (values (listof var-arrow?) hash[(list txt pos pos) -o> #t])
(define/private (position->matching-identifiers-hash the-text the-start-pos the-end-pos
include-require-arrows?)
(define binding-arrows (position-range->binding-arrows the-text the-start-pos the-end-pos
include-require-arrows?))
(define/private (position->matching-identifiers-hash the-text the-start-pos the-end-pos)
(define binding-arrows (position-range->binding-arrows the-text the-start-pos the-end-pos #f))
(values binding-arrows
(binding-arrows->identifiers-hash include-require-arrows? binding-arrows)))
(binding-arrows->identifiers-hash #f binding-arrows)))

(define/private (position-range->binding-arrows the-text the-start-pos the-end-pos
include-require-arrows?)
Expand Down Expand Up @@ -1883,7 +1879,7 @@ If the namespace does not, they are colored the unbound color.
;; callback for the jump popup menu item
(define/private (jump-to-next-callback start-pos end-pos txt backwards?)
(define-values (_binders make-identifiers-hash)
(position->matching-identifiers-hash txt start-pos end-pos #f))
(position->matching-identifiers-hash txt start-pos end-pos))
(define orig-arrows
(sort (hash-map (make-identifiers-hash)
(λ (x y) x))
Expand Down

0 comments on commit b344541

Please sign in to comment.