Skip to content
This repository was archived by the owner on Oct 26, 2023. It is now read-only.

Commit 7e5b259

Browse files
dannypsnljeapostrophe
authored andcommitted
extract hint-unused-variable
Signed-off-by: Lîm Tsú-thuàn <[email protected]>
1 parent 9d9d290 commit 7e5b259

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

doc-trace.rkt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
net/url
99
"interfaces.rkt"
1010
"responses.rkt"
11+
"path-util.rkt"
1112
"docs-helpers.rkt")
1213

1314
(struct Decl (require? id left right) #:transparent)
@@ -82,18 +83,20 @@
8283
(define/override (syncheck:add-require-open-menu text start finish file)
8384
(interval-map-set! requires start finish file))
8485
;; Mouse-over status
86+
(define (hint-unused-variable src-obj text start finish)
87+
(define diag (Diagnostic #:range (Range #:start (abs-pos->Pos doc-text start)
88+
#:end (abs-pos->Pos doc-text finish))
89+
#:severity Diag-Information
90+
#:source (path->uri src-obj)
91+
#:message "unused variable"))
92+
(set-add! warn-diags diag))
8593
(define/override (syncheck:add-mouse-over-status src-obj start finish text)
8694
;; Infer a length of 1 for zero-length ranges in the document.
8795
;; XXX This might not exactly match the behavior in DrRacket.
8896
(when (= start finish)
8997
(set! finish (add1 finish)))
9098
(when (string=? "no bound occurrences" text)
91-
(define diag (Diagnostic #:range (Range #:start (abs-pos->Pos doc-text start)
92-
#:end (abs-pos->Pos doc-text finish))
93-
#:severity Diag-Information
94-
#:source src-obj
95-
#:message "unused variable"))
96-
(set-add! warn-diags diag))
99+
(hint-unused-variable src-obj text start finish))
97100
(interval-map-set! hovers start finish text))
98101
;; Docs
99102
(define/override (syncheck:add-docs-menu text start finish id label path def-tag url-tag)

0 commit comments

Comments
 (0)