Skip to content

Conversation

@sheetalkamat
Copy link
Member

@sheetalkamat sheetalkamat commented Dec 12, 2025

  1. Dont watch failed lookups or affected files location in dynamic script
  2. Dont watch typeRoots if its the inferred root that is using server's current directory (which is lib file location and used if projectRootPath is not sepcified) as current directory or current directory is not watchable. (Sometimes chat blocks are created with projectRootPath as "/")
  3. Dont watch typing installers found location for same criteria

Fixes #62887

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Dec 12, 2025
@sheetalkamat sheetalkamat changed the title [wip] handle resolution watching for chat blocks Handle resolution watching when its dynamic scriptInfo Dec 12, 2025
@sheetalkamat sheetalkamat marked this pull request as ready for review December 12, 2025 23:33
Copy link

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 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TS Server Crash Loop: Copilot Chat virtual files ('vscode-chat-code-block') trigger infinite Directory Watcher recursion on InferredProject

3 participants