perf(vscode): optimize binary search for pnpm monorepos#17552
Closed
MIreland wants to merge 3 commits intooxc-project:mainfrom
Closed
perf(vscode): optimize binary search for pnpm monorepos#17552MIreland wants to merge 3 commits intooxc-project:mainfrom
MIreland wants to merge 3 commits intooxc-project:mainfrom
Conversation
Improve binary discovery performance in large pnpm monorepos by:
1. Search all workspace folders instead of only the first one
- Fixes issue where binary exists in a different workspace folder
- Particularly important for multi-root workspaces
2. Check direct paths before recursive glob search
- Try {workspace}/node_modules/.bin/{binary} directly first
- Avoids expensive recursive search through hundreds of directories
- In large monorepos with 800+ .bin directories, this provides
significant performance improvement
The new search strategy:
- Fast path: Direct file access check in all workspace folders
- Fallback: Recursive glob search only if direct check fails
- Error handling: Gracefully handles timeouts and permission issues
Fixes binary discovery issues in pnpm monorepos like orthlyweb where
oxlint is installed at the root but the extension couldn't find it.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Remove investigation notes from .gitignore
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes binary discovery in pnpm monorepos by implementing two key improvements: searching all workspace folders instead of only the first one, and adding a fast-path direct file check before expensive recursive glob searches.
- Replaces single-workspace binary search with multi-workspace iteration
- Adds direct
fs.access()check fornode_modules/.bin/{binary}before glob search - Extracts binary search logic into a dedicated
searchBinaryInWorkspacesmethod
Reviewed changes
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| editors/vscode/client/ConfigService.ts | Refactors binary discovery to check all workspaces with optimized direct path checking before falling back to recursive glob search |
| .gitignore | Adds investigation notes file to gitignore |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Addresses PR feedback: 1. Fix path format inconsistency - Convert directPath to proper file system path using Uri.file().fsPath - Ensures Windows paths use backslashes and proper drive letter format - Now both direct path check and glob search return consistently formatted paths 2. Add comprehensive test coverage for binary auto-discovery - Test finding binary in workspace node_modules/.bin/ - Test returning undefined when binary not found - Test finding oxfmt binary in workspace - Test proper file system path formatting (Windows and Unix) - All 4 new tests passing (29 total tests passing) The searchBinaryInWorkspaces method now has full test coverage for the auto-discovery behavior when no explicit binary path is configured. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Author
|
closing in favor of #17580 |
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.
Summary
Improves binary discovery performance in large pnpm monorepos by implementing two critical optimizations:
Changes
Search all workspace folders instead of only the first one
Check direct paths before recursive glob search
{workspace}/node_modules/.bin/{binary}directly first usingfs.access().bindirectories, this provides significant performance improvementNew Search Strategy
The optimized strategy is:
Problem Solved
Fixes binary discovery failures in large pnpm monorepos (like orthlyweb) where:
node_modules/.bin/**/node_modules/.bin/oxlintwould timeout due to searching through 800+.bindirectoriesTest Plan
Related Issues
This is the first PR in a series to improve VS Code extension performance in pnpm monorepos. See investigation notes in
vscode-binary-discovery-issues.md(gitignored).🤖 Generated with Claude Code