-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Description
The language server crashes when handling hover requests for non-Scheme files or special URI types like vscode-chat-code-block:// or vscode-notebook-cell://. The logs show multiple errors with the message:
(format "~s is not of type ~s" () #<record type file-node>)
This occurs because the hover functionality attempts to process these special URIs as if they were normal Scheme files, resulting in null file nodes being passed to functions expecting file-node records.
Steps to Reproduce
- Open a Scheme file in VS Code
- Copy code from the file into a VS Code chat window or notebook
- Attempt to hover over symbols in the copied code
- Observe errors in the language server log
Current Behavior
The language server responds with an error message when hovering over symbols in code blocks within chat windows or notebooks:
{"jsonrpc":"2.0","id":17,"error":{"code":-32001,"message":"textDocument\/hover"}}
Expected Behavior
The language server should:
- Recognize special URIs that don't represent actual files in the workspace
- Return an empty hover result for these URIs without attempting to process them as Scheme files
- Continue handling normal file-based Scheme URIs correctly
Root Cause
In hover.sls, the function attempts to process all URIs by converting them to file paths and finding corresponding file nodes. When it encounters special URIs that don't represent actual files, it returns null values that later cause type errors in the document processing code.
Proposed Solution
Modify the hover function in hover.sls to:
- Add checks to detect special URI schemes that not ends with Scheme extension like
.sls,.ss, and.spsand etc. - Return an empty hover result early when these special URI types are detected
- Only process URIs that represent actual Scheme files in the workspace
(define (valid-uri? uri)
;; check whether uri is a valid file path
)
;; Add this check in hover.sls
(if (not valid-uri? uri)
(make-alist 'contents (vector "")
;; Continue with regular processing...
)This should prevent the type errors while maintaining functionality for regular Scheme files.