Skip to content

terminalPackageWatcher completely hangs VS Code’s extension host infinitely #1683

Description

  • Issue Type: Performance
  • Extension Name: vscode-python-envs
  • Extension Version: 1.37.2026072901
  • OS Version: Linux x64 7.1.5-arch1-2
  • VS Code version: 1.131.0

Claude finally figured out why VS Code has become horribly slow for me when I use the terminal, and eventually stops working completely – it’s you!

This function is broken, the regex is extremely bad and will slow down things when there is moderate amounts of terminal output:

export function isPackageModifyingCommand(command: string): boolean {

How to fix

The issue is probably this regex part: (?:\S+\s+)*, which both does catastrophic backtracking and might hang forever. It is also completely useless since you already test, which isn’t anchored to the start of the string anyway.

Remove that, and ideally also just remove the terminal watcher until you have a benchmark setup in CI that tells you that it works much more efficiently than it does today.

ms-python.vscode-python-envs-unresponsive.cpuprofile.txt

Workaround

Disabling terminal integration disables the event being fired, but of course also more than that

{
  // https://github.com/microsoft/vscode-python-environments/issues/1683
  "terminal.integrated.shellIntegration.enabled": false,
}

Activity

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions