Skip to content

file_watcher: duplicate path_to_uri still uses bare format!("file://{}") #167

Description

@bug-ops

Description

file_watcher.rs contains a second path_to_uri implementation (around line 336) that still uses the old format!("file://{s}") pattern without percent-encoding reserved characters. PR #151 fixed the copy in bridge/state.rs but left this one untouched.

As a result, file-change notifications silently fail to trigger on paths containing [, ], ^, or | — the exact class of filenames PR #151 was designed to support (Next.js dynamic routes, etc.).

Reproduction Steps

  1. Open a project with a file named [slug].ts in the workspace root.
  2. Edit and save the file.
  3. Observe: LSP diagnostics / file-watching events are not forwarded because the URI sent in textDocument/didChange is unencoded while the URI registered in textDocument/didOpen (via bridge/state.rs) is encoded — they no longer match.

Expected Behavior

Both URIs should be identical; reserved characters percent-encoded consistently.

Actual Behavior

file_watcher.rs produces file:///path/[slug].ts; state.rs produces file:///path/%5Bslug%5D.ts — LSP server sees them as different documents.

Fix

Route file_watcher.rs:path_to_uri through the same encode_rfc3986_path_chars helper introduced in PR #151, or call Url::from_file_path directly (as the fixed implementation does).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions