Fix remote agent host file picker for new URI scheme#304541
Conversation
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @alexr00Matched files:
@bpaseroMatched files:
|
There was a problem hiding this comment.
Pull request overview
Updates the remote agent host folder picker flow to work with the new vscode-agent-host:// URI encoding by stripping/re-applying the encoded path prefix in the SimpleFileDialog, and by decoding agent-host URIs back into real remote filesystem paths where needed.
Changes:
- Add
scopedPathPrefixhandling inSimpleFileDialogto present “clean” paths while still constructing correct encodedvscode-agent-host://URIs. - Adjust remote agent host contribution code to derive working directories by decoding the repository URI.
- Add tests covering scoped path prefix behavior and agent host URI/root + label formatter consistency.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/services/dialogs/test/browser/simpleFileDialog.test.ts | New unit tests for scoped path prefix strip/reapply + round-trip behavior. |
| src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts | Implements computed scoped prefix, strips it for display, re-adds it when constructing URIs, and tightens “root” back-navigation. |
| src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHost.contribution.ts | Switches working-directory derivation to decode agent-host URIs. |
| src/vs/platform/agentHost/test/common/agentHostFileSystemProvider.test.ts | Adds tests for root encoding and formatter strip segment alignment. |
| src/vs/platform/agentHost/common/agentHostFileSystemProvider.ts | Treats decoded “root” paths as directories to support the encoded root forms. |
src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHost.contribution.ts
Outdated
Show resolved
Hide resolved
| public async showOpenDialog(options: IOpenDialogOptions = {}): Promise<URI[] | undefined> { | ||
| this.scheme = this.getScheme(options.availableFileSystems, options.defaultUri); | ||
| this.scopedAuthority = this.getScopedAuthority(options.defaultUri); | ||
| this.scopedPathPrefix = options.defaultUri && this.scopedAuthority ? this.computeScopedPathPrefix(options.defaultUri) : ''; |
There was a problem hiding this comment.
@alexr00 fyi agenthost uri paths now have a 'path' which encodes some extra data, then ends with the normal path that we want to display to the user. The point of this change is to detect that prefix automatically from the uri formatter, when this.scopedAuthority is set, and map between that formatted path and the real uri, so the user can work on the correctly formatted paths.
There was a problem hiding this comment.
If you think any of this is getting too complicated for this class, I could try to externalize some of this logic. I don't expect to make any more changes than this though.
There was a problem hiding this comment.
The simple file dialog is a bit of a mess, I don't think this makes it so much worse. Thank you though!
resolveWorkingDirectory could receive a file:// URI from a non-agent-host session. agentHostRemotePath would mis-decode those paths since it expects the encoded agent host path format. Gate decoding on AGENT_HOST_SCHEME and fall back to fsPath for file:// URIs. (Written by Copilot)
Update the remote agent host file picker to support a new URI scheme, ensuring proper decoding of paths for remote files.