Skip to content

rust: URI type implementation is non-compliant with LSP specification #442

Open

Description

Our current URI handling uses the rust-url crate, which implements the WHATWG URL spec. However, the Language Server Protocol (LSP) specification explicitly requires URI's to follow RFC 3986.

This causes parsing errors for valid file paths that contain special characters, such as [ or {, which are common in modern frontend frameworks (e.g., Next.js, SvelteKit).

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

Activity

  1. ribru17 commented on Sep 13, 2025

    @ribru17

    lsp-types uses fluent_uri for this reason, with some drawbacks (gluon-lang/lsp-types#284).

  2. solomatov commented on Oct 27, 2025

    @solomatov

    Riley Bruins (@ribru17), Umesh Yadav (@imumesh18)

    I tried parsing, and this code works fine:

    let u = Url::parse("https://aaa.com/[[[").unwrap();
    println!("{u:#?}");
    
  3. solomatov commented on Oct 27, 2025

    @solomatov

    Riley Bruins (@ribru17), Umesh Yadav (@imumesh18)

    This works fine too:

    let u = Url::parse("https://aaa.com/[[[/").unwrap();
    let w = u.join("[[[]]]");
    println!("{w:#?}");
    
  4. solomatov commented on Oct 28, 2025

    @solomatov

    Riley Bruins (@ribru17) It's a bit a different problem, but thanks for sharing. I would consider this crate just message formats, and would normalize urls when passing them to downstream code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions