fix/chat: Send workspace root as the expected URI, not a path #2352
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
JetBrains was initializing Agent passing a path instead of a workspace root URI. This is fine on UNIX-style systems, because the string
/foo/bar
is interpreted as a file URI. But on Windows it meant we were passing paths likec:/Users/bob/project
(yes... we convert the path separator to a forward slash etc.) and Agent was treating this as/Users/bob/project
which is wrong.The fix is simply to pass a URI instead of a file.
In addition,
normalizeUriOrPath
was lowercasing drive letters, but in the URI case only if the URI wasfile://C:/foo
; this fixes it to also handlefile:///C:/foo
(note the extra slash.)Note, Extension handling often? converts these URLs from
file:///c:/foo
tofile:///c%3a/foo
and does prefix checks on URIs as strings or paths, so we should consider canonicalizing colons in file URLs too, but that will take more care and attention. This change is enough to unbreak Prompt Library mentions on Windows.Test plan
On Windows,
@file.txt
presentation on a mention slab, instead of@C:\full\path\to\file.txt
without a mention slab.Changelog
file:///c:/Users/Bob/project
not/Users/bob/project
.