Skip to content

Conversation

@meganrogge
Copy link
Contributor

@meganrogge meganrogge commented Jan 7, 2026

fix part of #286155
fix #249896

File completions weren't working in WSL (and other remote environments) because when creating URIs for absolute paths, tilde paths (~), and $CDPATH entries, the code was using URI.file() which always creates a file:// URI pointing to the local host filesystem.

For example, when typing /home/user in a WSL terminal:

Before: URI.file('/home/user')file:///home/user → queries local Windows host
After: createUriFromLocalPath(cwd, '/home/user')vscode-remote://wsl+Ubuntu/home/user → queries remote WSL filesystem
Added a helper function createUriFromLocalPath that:

For local file:// URIs: Uses URI.file(path) to handle Windows path normalization
For remote URIs: Uses cwd.with({ path }) to preserve the scheme and authority

Copilot AI review requested due to automatic review settings January 7, 2026 18:03
@meganrogge meganrogge marked this pull request as draft January 7, 2026 18:03
@meganrogge meganrogge changed the title fix #286155 fix remote terminal suggest Jan 7, 2026
@meganrogge meganrogge self-assigned this Jan 7, 2026
@meganrogge meganrogge added this to the December 2025 milestone Jan 7, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issue #286155 by ensuring that remote file system authority (such as WSL connections) is preserved when resolving file paths in terminal completions. The fix replaces URI.file() calls with cwd.with({ path: ... }) to maintain the scheme and authority from the current working directory URI.

Key Changes:

  • Modified path resolution to preserve remote URI scheme and authority instead of always creating file:// URIs
  • Added test suite for remote file completion scenarios covering absolute paths, tilde expansion, and relative paths

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/vs/workbench/contrib/terminalContrib/suggest/browser/terminalCompletionService.ts Updated tilde expansion, absolute path, and CDPATH resolution to preserve remote authority by using cwd.with({ path: ... }) instead of URI.file()
src/vs/workbench/contrib/terminalContrib/suggest/test/browser/terminalCompletionService.test.ts Added remote file completion test suite with tests for absolute paths, tilde expansion, and relative paths in WSL context
Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/terminalContrib/suggest/test/browser/terminalCompletionService.test.ts:852

  • The test assertion is too weak to verify the fix. While it checks that completions are returned, it doesn't verify that the remote authority is actually preserved in the returned completions. The test should assert that the completion items or their underlying resources have the correct scheme ('vscode-remote') and authority ('wsl+Ubuntu'). Without this verification, the test could pass even if the bug still exists.
				// Check that results exist for remote tilde path
				assert.ok(result && result.length > 0, 'Should return completions for remote tilde path');
			});

@meganrogge meganrogge requested a review from Tyriar January 7, 2026 20:36
@meganrogge meganrogge marked this pull request as ready for review January 7, 2026 20:36
@meganrogge meganrogge modified the milestones: December 2025, January 2026 Jan 7, 2026
@meganrogge meganrogge merged commit 28873d3 into main Jan 8, 2026
49 checks passed
@meganrogge meganrogge deleted the fragile-puffin branch January 8, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

terminal.integrated.suggest with Remote - SSH suggests host directories

3 participants