Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception thrown on empty racket files #30

Closed
joebobmiles opened this issue Mar 2, 2021 · 1 comment · Fixed by #38
Closed

Exception thrown on empty racket files #30

joebobmiles opened this issue Mar 2, 2021 · 1 comment · Fixed by #38

Comments

@joebobmiles
Copy link

This seems to be related to #12. I just installed Racket 8.0 and racket-langserver on Windows 10 for use with VSCode and the Magic Racket extension. The instant I opened an empty .rkt file, racket-langserver threw the following error:

Caught exn in request "textDocument/documentHighlight"
hash-ref: no value found for key
  key: 'file:///c:/Users/user/Documents/Programming/hello-racket/hello.rkt
  context...:
   C:\Users\user\AppData\Roaming\Racket\8.0\pkgs\racket-langserver\text-document.rkt:207:0: get-doc-refs
   C:\Users\user\AppData\Roaming\Racket\8.0\pkgs\racket-langserver\text-document.rkt:191:0: document-highlight
   C:\Program Files\Racket\collects\racket\contract\private\arrow-val-first.rkt:486:18
   C:\Users\user\AppData\Roaming\Racket\8.0\pkgs\racket-langserver\methods.rkt:26:0: process-message
   C:\Program Files\Racket\collects\racket\contract\private\arrow-val-first.rkt:486:18
   C:\Users\user\AppData\Roaming\Racket\8.0\pkgs\racket-langserver\main.rkt:54:2: consume

[Error - 7:45:07 PM] Request textDocument/documentHighlight failed.
  Message: internal error in method "textDocument/documentHighlight"
  Code: -32603

My best guess is that the key format 'file:///c:/...' is causing the problem, specifically the third slash following 'file.'

@jeapostrophe
Copy link
Owner

I have two hypotheses:

  1. That VSCode sent the textDocument/documentHighlight request before the textDocument/didOpen request

  2. That it did send the didOpen, but there is some small difference in the case/etc of the file path that causes the two database entries in the langserver to not match.

Does VSCode let you see a log of its interaction with the server? (Perhaps in the same place you saw this error?) If so, you could add in between these two lines (https://github.com/jeapostrophe/racket-langserver/blob/master/methods.rkt#L26-L27) (eprintf "~s" msg) and see what it says

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants