racket-langserver
racket-langserver copied to clipboard
Class name and its method names diagnosed as unbound variables
For the following file:
#lang racket/base
(require racket/class)
(define test%
(class object%
(define/public (testes)
(displayln "not funny"))))
the class name test%
and method name testes
(sorry, inappropriate humor) show as unused variables:
The attached log of communication between the magic-racket
plugin and the racket-langserver
LSP show this coming from the LSP. Search for the second textDocument/publishDiagnostics
message from server
to client-1
.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy
$ raco pkg show
Installation-wide:
Package Checksum Source
main-distribution 5a53b6db4ffcbdd4... catalog...tribution
racket-lib 9347cf1b6f832640... catalog racket-lib
[202 auto-installed packages not shown]
User-specific for installation "8.9":
Package Checksum Source
racket-langserver 570b19570db40647... catalog...erver.git
try-catch-finally ae71f04fe3ef793e... catalog...h-finally
[7 auto-installed packages not shown]
I also tried running the plugin against a local fork of the racket-langserver
code and got the same thing. I may dig into the code and see what I can figure out, but not immediately.
If you open that code in DrRacket, you will find it said test%
"no bound occurrences"
In racket-langserver, I just check that label^1, so I don't think we are able to fix this here.
You're right. I hadn't referenced the class in my test case. I added:
(define a-test (new test%))
(send a-test testes)
to the file and the error attached to the class name went away in DrRacket
, but the error attached to the method did not even though I referenced it. The same thing happened with magic-racket
. So it appears to be a DrRacket
issue (or further misunderstanding on my part).
Found
- https://github.com/racket/drracket/issues/369 and
- https://github.com/greghendershott/racket-mode/issues/440 so definitely an issue and already reported.
Close this issue at your leisure, sorry to waste your time.