Skip to content

fix terminal suggest regression#287187

Merged
meganrogge merged 4 commits intomainfrom
generous-koala
Jan 13, 2026
Merged

fix terminal suggest regression#287187
meganrogge merged 4 commits intomainfrom
generous-koala

Conversation

@meganrogge
Copy link
Collaborator

fixes #287161

cc @Tyriar

The bug was caused by double-navigation when typing ../:

  • Extension side: resolveCwdFromCurrentCommandString() was pre-resolving ../ paths, setting cwd to the parent directory
  • Completion service side: When processing ../, it did URI.joinPath(cwd, '../') which navigated up AGAIN from the already-resolved parent

So typing ../ from vscode resulted in:

  • Extension resolved cwd to Repos (parent)
  • Completion service then did joinPath(parent, '../') = meganrogge(grandparent)
  • Children shown were from grandparent, showing Repos instead of xterm.js

Added a check in resolveCwdFromCurrentCommandString to skip pre-resolution for paths containing .. to fix this.

Copilot AI review requested due to automatic review settings January 12, 2026 23:05
@meganrogge meganrogge self-assigned this Jan 12, 2026
@meganrogge meganrogge added this to the January 2026 milestone Jan 12, 2026
@meganrogge meganrogge enabled auto-merge (squash) January 12, 2026 23:06
mjbvz
mjbvz previously approved these changes Jan 12, 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 a terminal suggest regression where typing ../ would show completions from the grandparent directory instead of the parent directory, caused by double-navigation in cwd resolution.

Changes:

  • Skip pre-resolution of paths containing .. in the extension to prevent double-navigation
  • Use lastWordFolderResource instead of cwd for computing the parent directory completion item to ensure it's relative to the viewed folder
  • Add test coverage for ../ completion behavior and update existing test expectations

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
extensions/terminal-suggest/src/terminalSuggestMain.ts Adds check to skip pre-resolving paths containing .. segments to avoid double-navigation
src/vs/workbench/contrib/terminalContrib/suggest/browser/terminalCompletionService.ts Changes parent directory completion to use lastWordFolderResource instead of cwd for correct relative navigation
src/vs/workbench/contrib/terminalContrib/suggest/test/browser/terminalCompletionService.test.ts Adds test for ../ completions and updates test expectation for ./test/../ path normalization

@meganrogge meganrogge merged commit 1fbcce5 into main Jan 13, 2026
22 checks passed
@meganrogge meganrogge deleted the generous-koala branch January 13, 2026 00:40
meganrogge added a commit that referenced this pull request Jan 13, 2026
meganrogge added a commit that referenced this pull request Jan 13, 2026
fix terminal suggest regression (#287187)

fixes #287161
eli-w-king pushed a commit that referenced this pull request Jan 14, 2026
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-suggest: ls ../ brings up wrong file suggestions

4 participants