Skip to content

Go to definition fails on Windows due to malformed URI in RPC response #54

@lingyaochu

Description

@lingyaochu

When using pytest-language-server in Zed on Windows, "Go to definition" fails for fixtures defined in external files (e.g., conftest.py). The editor fails to perform the jump and instead displays references, as if the language server were not active.

The relevant RPC messages are as follows:

Send:

// Send:
{"jsonrpc":"2.0","id":26,"method":"textDocument/definition","params":{"textDocument":{"uri":"file:///D:/code/vaspin/tests/test_outcar.py"},"position":{"line":26,"character":28}}}

Receive:
The returned uri appears to be malformed, possibly due to incorrect handling of Windows path prefixes:

// Receive:
{"jsonrpc":"2.0","result":{"range":{"end":{"character":0,"line":8},"start":{"character":0,"line":8}},"uri":"file://///%3F/D%3A/code/vaspin/tests/conftest.py"},"id":26}

Zed error logs:

2026-01-16T18:58:30+08:00 ERROR [project::lsp_store] Error handling response for request GetDefinitions { position: PointUtf16 { row: 26, column: 28 } }: can't convert URI to path

It appears that the server is returning an invalid file URI on Windows, which prevents the editor from resolving the file path correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions