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

de-normalizing Uri while parsing #276

Open
nkitsaini opened this issue Feb 17, 2024 · 0 comments
Open

de-normalizing Uri while parsing #276

nkitsaini opened this issue Feb 17, 2024 · 0 comments

Comments

@nkitsaini
Copy link

nkitsaini commented Feb 17, 2024

From: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#uri

The URIs below are both valid

file:///c:/project/readme.md
file:///C%3A/project/readme.md

Although not a strict requirement from spec, the reference implementation tries to percent-decode the uri safely: https://github.com/microsoft/vscode-uri/blob/6dec22d7dcc6c63c30343d3a8d56050d0078cb6a/src/uri.ts#L274. If this was supported here, it might make the dealing with Uri a little simpler for the dependent projects.

Currently we use url crate provided serde deserialisation, which doesn't percent-decode the string. As a real life example svelteserver encodes the uri but tsc does not.

Example deserialization using lsp-types lib: Rust Playground
Example deserialization using vscode-uri (official implementation): Javascript Playground

@nkitsaini nkitsaini changed the title Uri parsing does not follow the spec supporting deserialization of normalized Uri Feb 20, 2024
@nkitsaini nkitsaini changed the title supporting deserialization of normalized Uri de-normalizing Uri while parsing Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant