Skip to content

fix: use dunce::canonicalize to strip \\?\ prefix on Windows#185

Open
Jokerkern wants to merge 1 commit intoWhatsApp:mainfrom
Jokerkern:fix/windows-canonicalize-path
Open

fix: use dunce::canonicalize to strip \\?\ prefix on Windows#185
Jokerkern wants to merge 1 commit intoWhatsApp:mainfrom
Jokerkern:fix/windows-canonicalize-path

Conversation

@Jokerkern
Copy link
Copy Markdown

Problem

On Windows, std::fs::canonicalize returns paths prefixed with \\?\
(e.g. \\?\E:\project\...). When ELP matches a file opened in VS Code
against the app's source root, the comparison fails because VS Code URIs
resolve to plain paths like E:\project\... — the \\?\ prefix causes
a mismatch.

This causes every file to fall into the catch-all source root, which has
no app_data. The result is that all rebar3 projects on Windows are broken:

  • L0003 "Unknown application" errors on every file
  • Cross-file navigation (go-to-definition) not working
  • Find references not working across files

Fix

Replace fs::canonicalize with dunce::canonicalize in into_abs_path.
The dunce crate is a well-known lightweight solution for this exact
problem, stripping the \\?\ prefix on Windows while behaving
identically to std::fs::canonicalize on all other platforms.

Testing

Verified on Windows 10 with a rebar3 project. All issues above are
resolved after this fix.

@meta-cla
Copy link
Copy Markdown

meta-cla bot commented Mar 30, 2026

Hi @Jokerkern!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla meta-cla bot added the cla signed label Mar 30, 2026
@meta-cla
Copy link
Copy Markdown

meta-cla bot commented Mar 30, 2026

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant