Skip to content

Unrecognized LSP requests are silently dropped instead of returning MethodNotFound (-32601) #3981

@kylesnowschwartz

Description

@kylesnowschwartz

The process_message case statement in lib/ruby_lsp/server.rb has no else clause, so when the server receives a request for an unsupported method (e.g. textDocument/prepareCallHierarchy), it matches no branch, returns nil, and never sends a response. The LSP spec requires servers to respond to any request bearing an id — for unsupported methods, that's error code -32601 (MethodNotFound). The silent drop causes well-behaved clients to hang indefinitely waiting for a response. Adding an else branch that calls send_message(Error.new(id: message[:id], code: -32601, message: "Method not found: #{message[:method]}")) when message[:id] is present would fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions