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
- Open a project with a file named
[slug].ts in the workspace root.
- Edit and save the file.
- 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).
Description
file_watcher.rscontains a secondpath_to_uriimplementation (around line 336) that still uses the oldformat!("file://{s}")pattern without percent-encoding reserved characters. PR #151 fixed the copy inbridge/state.rsbut 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
[slug].tsin the workspace root.textDocument/didChangeis unencoded while the URI registered intextDocument/didOpen(viabridge/state.rs) is encoded — they no longer match.Expected Behavior
Both URIs should be identical; reserved characters percent-encoded consistently.
Actual Behavior
file_watcher.rsproducesfile:///path/[slug].ts;state.rsproducesfile:///path/%5Bslug%5D.ts— LSP server sees them as different documents.Fix
Route
file_watcher.rs:path_to_urithrough the sameencode_rfc3986_path_charshelper introduced in PR #151, or callUrl::from_file_pathdirectly (as the fixed implementation does).