Skip to content

Non-file URI in LSP response has first letter of path converted to lowercase (starting from Pyright 1.1.351) #7495

@jwortmann

Description

@jwortmann

Describe the bug

I'm using Pyright as an LSP server in Sublime Text. I've noticed that starting with Pyright 1.1.351, the first letter of the path component of a server response is always converted to lowercase. According to the LSP specs, this is allowed for the drive letter (in file: URIs):

Clients and servers should not assume that each other are encoding the same way (for example a client encoding colons in drive letters cannot assume server responses will have encoded colons). The same applies to casing of drive letters - one party should not assume the other party will return paths with drive letters cased the same as itself.

but it can be problematic (and I assume is not allowed) in non-file URIs, where the first character of the path component is not necessarily a drive letter.

Example params of a textDocument/definition request:

{
    "position": {
        "character": 19,
        "line": 26
    },
    "textDocument": {
        "uri": "res://Packages/Default/symbol.py"
    },
    "workDoneToken": "$ublime-work-done-progress-6"
}

Response:

[
    {
        "uri": "res://packages/Default/symbol.py",
        "range": {
            "end": {
                "character": 17,
                "line": 7
            },
            "start": {
                "character": 4,
                "line": 7
            }
        }
    }
]

Here the letter P should not be lowercased, because it is not a drive letter. Pyright version 1.1.350 and earlier did respond with the correct letter casing.

The res: scheme is used by this client for "virtual" files that don't have a path on disk, but are extracted in memory from a .zip file.

VS Code extension or command-line

  • Pyright 1.1.351 or newer (also tested with the latest version 1.1.354) used as an LSP server in Sublime Text
  • Windows 11

Metadata

Metadata

Assignees

Labels

as designedNot a bug, working as intendedbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions