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

Frequent hover errors in a file that opened before the plugin loaded #108

Open
Reilithion opened this issue May 30, 2023 · 4 comments
Open
Labels
bug Something isn't working langserver

Comments

@Reilithion
Copy link

Sometimes I notice that any time I move my mouse within a Racket source file in VSCodium an error pops up in the Output pane. It gets quite annoying after a while. I've noticed this behavior in files that were open before the plugin loaded - for example, files that were open when I last closed the program and therefore opened automatically when I relaunched it.

Based on the error message I suspect this is a simple oversight in the handling of cases when an entry in a hash table is absent, but I'm happy to reproduce the error with more debug info on if needed.

Environment

  • OS: Windows 10
  • OS Version: 10.0.19045 Build 19045
  • VS Code Version: VSCodium Version: 1.77.3 (system setup)
    Release: 23102
    Commit: 650fc437e02159df39d99355a91b2e3b1f1220c5
    Date: 2023-04-12T18:28:14.437Z
    Electron: 19.1.9
    Chromium: 102.0.5005.167
    Node.js: 16.14.2
    V8: 10.2.154.15-electron.0
    OS: Windows_NT x64 10.0.19045
    Sandboxed: No
  • Racket version: 8.9 [cs]
  • Racket Langserver checksum: racket-langserver 570b19570db40647c5ae69c73a67d3a05466a465 catalog...erver.git
  • Magic Racket version: v0.6.2

Error message

[Error - 4:44:21 PM] Request textDocument/hover failed.
Message: internal error in method "textDocument/hover"
Code: -32603
Caught exn in request "textDocument/hover"
hash-ref: no value found for key
key: 'file:///c:/Users/Lucas/ETCETERA/myfile.rkt'
context...:
C:\Users\Lucas\AppData\Roaming\Racket\8.9\pkgs\racket-langserver\text-document.rkt:117:0: hover
C:\Program Files\Racket\collects\racket\contract\private\arrow-val-first.rkt:486:18
C:\Users\Lucas\AppData\Roaming\Racket\8.9\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\Lucas\AppData\Roaming\Racket\8.9\pkgs\racket-langserver\main.rkt:60:2: consume

@Reilithion Reilithion added the bug Something isn't working label May 30, 2023
@jryans
Copy link
Collaborator

jryans commented May 30, 2023

Thanks for the report!

Have you noticed if it happens consistently for particular files? Or does it appear to be any file that you've left open...? I ask because I've occasionally seen similar errors, but it was always limited to specific files in my experience.

If it does seem specific to certain files, then it would be very helpful if you could share one of the affected files somehow, either via a link, gist, or email.

@Reilithion
Copy link
Author

I may have been mistaken about the cause. I created a new file (call it test.rkt), copied and pasted the entire contents of the problem file into it and saved. As expected, there were no issues with hover in this new file. I then closed VSCodium and reopened it. To my surprise test.rkt continued to have well-behaving hover, but the original file continued to be problematic. I also was unable to get it to behave by closing and reopening the file.

I've since created a new file which is much more minimal. When I first saved it everything was working fine. But when I committed it in git, it began exhibiting errors on hover! Here are the entire contents of that file:

#lang racket/base

#|
Copyright 2023 Lucas Adam Michael Paul

This file is part of SomeProject.
SomeProjectis free software: you can redistribute it and/or modify it under the terms of the GNU
Lesser General Public License as published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
SomeProjectis distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with SomeProject. If
not, see <https://www.gnu.org/licenses/>. 
|#

(require
  racket/unit
  "games.rkt")

(module+ test
  (require rackunit))

#|
  This is a trivial agent.
  It waits for a single move, ignores it, and then plays the string "foo", then terminates.
|#
(define-unit trivial-agent@
  (import game^)
  (export agent^)

  (define (strategy)
    (await)
    (play "foo"))
)

@Reilithion
Copy link
Author

As extra context, I have admittedly updated VSCodium since last time. Also, the game^ and agent^ signatures are defined in games.rkt. game^ exports await and play while agent^ exports strategy.

@jryans
Copy link
Collaborator

jryans commented Jun 13, 2023

I wasn't able to replicate the issue with your attached file, perhaps because I don't have the other associated files it tries to import... If it's possible to share a bit more of your project so that I can be sure I'm testing the same case as you're seeing, that would be ideal.

Even without that though, I have noticed similar hash-ref: no value found for key errors when exploring other unit-based files, such as those in https://github.com/philnguyen/soft-contract. My current hypothesis then is that something about units causes the language server to get confused when processing such files. I'll try to isolate what goes wrong in more detail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working langserver
Projects
None yet
Development

No branches or pull requests

2 participants