You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Go to definition shows duplicate definitions due to URI different between file:///c%3A/ and file:///c:/ on Windows #3285
This looks only partially fixed. #3381 escaped the colon, which removed the raw c: form, but the drive letter case still differs, so the two URIs can still disagree.
vscode-uri normalises the drive letter to lower case regardless of input, while from_path preserves whatever case it was given. The server discovers files through Dir.glob and Dir.pwd, which return an upper case drive on Windows, so a file found by indexing becomes file:///C%3A/... while the same file opened in the editor arrives as file:///c%3A/... — two keys for one file, which is the duplicate result reported here.
#3881 reports the same case mismatch in a different place (Dir.pwd upper case vs. lower case keys in the reporter port database), so it does not appear specific to one code path.
Two things worth knowing for anyone picking this up:
test_from_path_on_windows and test_from_path_on_windows_with_lowercase_drive currently assert that the case is preserved, so today's behaviour is deliberate rather than an oversight.
GlobalState#workspace_path comes from the client's URI (lower case drive) while Dir.pwd is upper case, and server.rb has several case-sensitive path.start_with?(@global_state.workspace_path) guards. Normalising only from_path risks trading one Windows bug for another, so those probably need to move together.
I could only verify the encoding difference above; I do not have a Windows machine to confirm the start_with? half.
Noticed while working on #4022, which narrows from_path's escaping to match vscode-uri for everything except this. That PR deliberately leaves the drive letter alone, for the reasons above.
Activity
egiurleo commentedon Mar 13, 2025
Hi @son-urban! Thanks for opening this issue. We don't have the capacity to address this right now, but we'd welcome a PR to fix it!
andriytyurnikov commentedon Jul 31, 2026
This looks only partially fixed. #3381 escaped the colon, which removed the raw
c:form, but the drive letter case still differs, so the two URIs can still disagree.Server side:
Editor side (
vscode-uri3.1.0, which is what VS Code builds its URIs with):vscode-urinormalises the drive letter to lower case regardless of input, whilefrom_pathpreserves whatever case it was given. The server discovers files throughDir.globandDir.pwd, which return an upper case drive on Windows, so a file found by indexing becomesfile:///C%3A/...while the same file opened in the editor arrives asfile:///c%3A/...— two keys for one file, which is the duplicate result reported here.#3881 reports the same case mismatch in a different place (
Dir.pwdupper case vs. lower case keys in the reporter port database), so it does not appear specific to one code path.Two things worth knowing for anyone picking this up:
test_from_path_on_windowsandtest_from_path_on_windows_with_lowercase_drivecurrently assert that the case is preserved, so today's behaviour is deliberate rather than an oversight.GlobalState#workspace_pathcomes from the client's URI (lower case drive) whileDir.pwdis upper case, andserver.rbhas several case-sensitivepath.start_with?(@global_state.workspace_path)guards. Normalising onlyfrom_pathrisks trading one Windows bug for another, so those probably need to move together.I could only verify the encoding difference above; I do not have a Windows machine to confirm the
start_with?half.Noticed while working on #4022, which narrows
from_path's escaping to matchvscode-urifor everything except this. That PR deliberately leaves the drive letter alone, for the reasons above.Escape URIs like the editor does and harden Dir.glob against metachar…