Skip to content

vscode-languageclient escapes drive colon on doc URIs on Win #144698

Closed

Description

@BoykoAlex

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.65 (also noted in 1.63)
  • OS Version: Win 10 (windows only)

Steps to Reproduce:
Install RedHat Java Language extension to test vscode-languageclient really

  1. Set "java.trace.server: "verbose" in the settings.json to see LSP messages that VSCode sends to Java LS
  2. Open some Java project in VSCode and then open a Java file
  3. Switch on the Output tab and select Language Support for Java in the drop down
  4. Examine the LSP messages and note doc URIs that look like: file:///c%3A/Users/sasha/Documents/..., i.e. with escaped drive colon (!?)
  5. Search for string symbol. You'd find something like:
[Trace - 12:35:52 PM] Sending request 'textDocument/documentSymbol - (22)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/sasha/Documents/workspace-spring-tool-suite-4-4.9.0.RELEASE/spring-petclinic/src/main/java/org/springframework/samples/petclinic/owner/PetRepository.java"
    }
}

In other words the doc URI is sent from the vscode-languageclient with escaped drive colon which is wrong i think. The drive colon should NOT be escaped. This makes Spring Tools language server not to work properly on Windows

Activity

  1. dbaeumer commented on Mar 9, 2022

    @dbaeumer
    Member

    Alex Boyko (@BoykoAlex) escaping the colon in drive letters is the default behavior in VS Code. This is why the LSP client for VS Code follows that rule.

    However the extension has control over this when creating the LSP client by specifying URI converters. See https://github.com/microsoft/vscode-languageserver-node/blob/5c2e1065493290110bd7c7ea1b10cd6fa08eb81c/client/src/common/client.ts#L684

  2. dbaeumer commented on Mar 9, 2022

    @dbaeumer
    Member

    In the converter function you can simply call uri.toString(true) which will skip these encodings.

  3. locked and limited conversation to collaborators on Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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