jeapostrophe / racket-langserver

Other
262 stars 24 forks source link

Class name and its method names diagnosed as unbound variables #105

Open madkins23 opened 1 year ago

madkins23 commented 1 year ago

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:

small-class

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.

dannypsnl commented 1 year ago

If you open that code in DrRacket, you will find it said test% "no bound occurrences"

image

In racket-langserver, I just check that label^1, so I don't think we are able to fix this here.

madkins23 commented 1 year ago

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).

madkins23 commented 1 year ago

Found

Close this issue at your leisure, sorry to waste your time.