Skip to content

Hover Functionality Failing with Special URI Types #9

@dezzw

Description

@dezzw

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

  1. Open a Scheme file in VS Code
  2. Copy code from the file into a VS Code chat window or notebook
  3. Attempt to hover over symbols in the copied code
  4. 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:

  1. Recognize special URIs that don't represent actual files in the workspace
  2. Return an empty hover result for these URIs without attempting to process them as Scheme files
  3. 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:

  1. Add checks to detect special URI schemes that not ends with Scheme extension like .sls, .ss, and .sps and etc.
  2. Return an empty hover result early when these special URI types are detected
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions