-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Handle resolution watching when its dynamic scriptInfo #62894
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
base: main
Are you sure you want to change the base?
Conversation
…ble or is inferred project with hosts current directory
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 addresses issue #62887 by preventing unnecessary file watchers from being created for dynamic script infos (e.g., chat blocks, untitled files). Dynamic scripts are identified by paths starting with ^ and don't correspond to actual filesystem locations, so watching their resolution paths, type roots, and typing installer locations is unnecessary and can cause issues.
Key Changes:
- Skip watching failed lookups and affected file locations for dynamic scripts
- Skip watching type roots when inferred project's current directory is the server's current directory (lib location) or not watchable (e.g., projectRootPath="/")
- Skip watching typing installer locations under the same criteria
Reviewed changes
Copilot reviewed 52 out of 52 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/server/project.ts | Added logic to skip watching typing locations and type roots for non-watchable directories; added helper methods to identify when to skip watching |
| src/compiler/resolutionCache.ts | Integrated skip watching logic into resolution caching for failed lookups and type roots |
| src/harness/incrementalUtils.ts | Updated test infrastructure to track watched status of resolutions |
| src/testRunner/unittests/tsserver/dynamicFiles.ts | Added new test case for chat blocks with imports |
| tests/baselines/reference/* | Updated baselines showing removed watcher creation for dynamic files and non-watchable scenarios |
Fixes #62887