-
Notifications
You must be signed in to change notification settings - Fork 63
Fix rewatch lockfile detection on Windows #1160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…lookup logic Refactor findProjectRootOfFile to use separate functions for file vs directory lookups, eliminating confusing boolean parameter and fixing the case where exact directory matches were incorrectly excluded.
There was a problem hiding this 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 Windows lockfile detection issue by refactoring the findProjectRootOfFile function to eliminate a confusing boolean parameter. The refactoring splits the functionality into two separate functions: one for file lookups (findProjectRootOfFile) and one for directory lookups (findProjectRootOfDir), with the key difference being that directory lookups allow exact matches while file lookups exclude them.
Key Changes:
- Separated file and directory lookup logic into distinct functions with clear semantics
- Removed the confusing
allowDirboolean parameter fromfindProjectRootOfFile - Added comprehensive JSDoc documentation for the new function structure
- Updated all call sites to use the appropriate function based on whether a file or directory is being searched
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| server/src/utils.ts | Refactored findProjectRootOfFile into separate findProjectRootOfFile and findProjectRootOfDir functions with helper functions findProjectRootContainingFile and findProjectRootMatchingDir for clarity; added debug logging statements |
| server/src/incrementalCompilation.ts | Updated to use new findProjectRootOfDir function for directory lookups |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
zth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good from what I can tell!
|
@nojaf this is great -- much cleaner |
I would not say that we nailed down everything related to searching monorepo structures.
For the runtime and binary, in a best case a We also don't quite take anything npm/pnpm/bun specific into account of a monorepo. |
Refactor findProjectRootOfFile to use separate functions for file vs directory lookups, eliminating confusing boolean parameter and fixing the case where exact directory matches were incorrectly excluded.
This fixed #1155 for me on Windows.