LSP Falsely Calls "unused require"
Nobody has claimed this yet.
- Dominant language
- Racket
- Stars
- 516
- Forks
- 103
- PR merge metrics
- No merged PRs in 30d
Description
In this file (at this commit https://github.com/veqqq/verse-reader/commit/9d85176d956927f1423d5066b034ad9c882680fd#diff-03ff549a899d4177544a2571db77418a19e57495987c3bfc80d618d8a200ee48 ) the following code occurs:
(module verse-struct racket/base
(require racket/string)
; Changed to prefab for compile-time support
(struct bible-verse (
[abbrev #:mutable]
[chapter #:mutable]
[verse #:mutable]
[text #:mutable])
#:prefab)
; Parse string to extract verse
(define (parse-verse-line line)
(define parts (string-split line "\t"))
(if (= (length parts) 5)
(bible-verse
;; note, no book
(string-downcase (list-ref parts 1)) ; abbreviation
(string->number (list-ref parts 2)) ; chapter
(string->number (list-ref parts 3)) ; verse
(list-ref parts 4)) ; text
(begin
(printf "Skipping non-verse line: ~a\n" line)
#f)))
(provide bible-verse bible-verse? parse-verse-line
bible-verse-abbrev
bible-verse-chapter bible-verse-verse
bible-verse-text))
(require 'verse-struct
(for-syntax 'verse-struct))
; Compile-time parse
(begin-for-syntax
(define-runtime-path kjv-path "kjv.tsv")
(define kjv-verses
(filter values
(for/list ([line (in-list (with-input-from-file kjv-path port->lines))])
(parse-verse-line line)))))
If you remove the for-syntax require, the begin-for-syntax of course won't have the parse-verse-line function identifier...
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the referenced commit and inspect how the LSP analyzes the require and begin-for-syntax forms in the shown module. Reproduce the diagnostic with the for-syntax import present and absent. Done means the required binding is not reported as unused when parse-verse-line is referenced at compile time.
Written by the indexing model from the issue text.
Assessment
- Domain
- developer-experience, devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100