Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
BoykoAlex opened this issue Mar 8, 2022 · 2 comments
Closed

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

BoykoAlex opened this issue Mar 8, 2022 · 2 comments
Assignees

Comments

@BoykoAlex
Copy link
Contributor

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

@dbaeumer
Copy link
Member

dbaeumer commented Mar 9, 2022

@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

@dbaeumer dbaeumer closed this as completed Mar 9, 2022
@dbaeumer
Copy link
Member

dbaeumer commented Mar 9, 2022

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

@github-actions github-actions bot locked and limited conversation to collaborators Apr 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@jrieken @dbaeumer @TylerLeonhardt @BoykoAlex and others