Repository navigation
terminal-suggest: fix root directory check in npm and yarn package.json lookup - #347265
Merged
Megan Rogge (meganrogge) merged 1 commit intoNov 13, 2026
Conversation
Contributor
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.
Megan Rogge (meganrogge)
enabled auto-merge
November 11, 2026 18:49
Bhavya U (bhavyaus)
requested review from
Megan Rogge (meganrogge)
and
a balanced review from Copilot
November 11, 2026 19:31
Contributor
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.
Contributor
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.
Megan Rogge (meganrogge)
approved these changes
Nov 13, 2026
Michael Lively (Yoyokrazy)
approved these changes
Nov 13, 2026
Federico Brancasi (federicobrancasi)
approved these changes
Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #326920
Problem
In
extensions/terminal-suggest/src/completions/npm.tsandyarn.ts, the shell command used to locatepackage.jsonin parent directories checked whether$PWDequaled' / 'instead of'/'. When terminal suggestions run in a directory that has no ancestorpackage.json,$PWDreaches the filesystem root/, which never matches' / '. As a result, the loop never terminates and spawns runaway bash processes consuming 100% CPU.Fix
Correct the root directory condition in the generator scripts for both npm and yarn completions to match
[[ $PWD = '/' ]], consistent withnpx.tsline 16 andyarn.tsline 395.Verification
bash -c "until [[ -f package.json ]] || [[ $PWD = '/' ]]; do cd ..; done; cat package.json"terminates immediately upon reaching the filesystem root when nopackage.jsonexists.