Skip to content

Nonresponsive editor with large project when typescript.tsserver.watchOptions: vscode #237351

@pelmers-db

Description

@pelmers-db

Does this issue occur when all extensions are disabled?: No

  • VS Code Version: 1.96.2
  • OS Version: Client = Macos 14.7, Remote = Linux 5.4

Steps to Reproduce:

  1. Connect to remote ssh
  2. Open a project with 20000+ .tsx files
  3. Observe extreme slowness (5+ seconds to respond) with basic editor file actions: open file, save file, close file, etc.

Debugging notes:

  1. when set typescript output to trace mode I see one watch event per file, e.g. [trace] <semantic> Event received: createFileWatcher (0). { "id": 364, "path": "/home/peter.elmers/fortesting/generated_tsx_project/src/Component10322.tsx" }
  2. from reading code, looks like this hits the nonRecursiveWatcher which is nodejs: https://github.com/microsoft/vscode/blob/292d0bd51af8d7e107fa34b00955aceb7d9c03d5/src/vs/platform/files/node/watcher/watcher.ts/#L16-L17
  3. all the watchers pile up and get sent to the nodejs watcher code, I believe that triggers a quadratic time loop in this function: https://github.com/microsoft/vscode/blob/292d0bd51af8d7e107fa34b00955aceb7d9c03d5/src/vs/platform/files/node/watcher/nodejs/nodejsWatcher.ts/#L45-L52

The issue seems to be that every time watchers change then we send in all of the watchers, so the watch code needs to loop through the list many times and find which ones to remove and which ones to keep. But this is just a cursory look.

cc @bpasero

Metadata

Metadata

Assignees

Labels

author-verification-requestedIssues potentially verifiable by issue authorbugIssue identified by VS Code Team member as probable bugconfirmedIssue has been confirmed by VS Code Team memberfile-watcherFile watcherfreeze-slow-crash-leakVS Code crashing, performance, freeze and memory leak issuesinsiders-releasedPatch has been released in VS Code InsiderstypescriptTypescript support issuesverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions