typescript-lsp plugin reports diagnostics for files that no longer exist after branch switch
Description
The typescript-lsp plugin (from claude-plugins-official) reports diagnostics for files that no longer exist on disk after switching git branches. This creates noisy diagnostic notifications (e.g., "Found 24 new diagnostic issues in 9 files") for non-existent files, and Claude wastes context commenting on them.
Steps to reproduce
- Install the
typescript-lspplugin - Work on a branch that has certain TypeScript files (e.g.,
build-default.ts,project-to-current-vis-shape.ts) - Switch to a different branch where those files don't exist
- Edit any TypeScript file
Expected behavior
Diagnostics should only be reported for files that exist on disk. The LSP should re-index or invalidate its cache when the workspace files change (e.g., after a git branch switch).
Actual behavior
The LSP continues reporting diagnostics (e.g., TS2307 "Cannot find module") for files from the previous branch that no longer exist. These show up as <new-diagnostics> after every edit, creating noise.
Environment
- typescript-language-server v5.1.3 (globally installed)
- Claude Code with
typescript-lsp@claude-plugins-officialenabled - macOS (Darwin 25.3.0)
Possible fix
The plugin could:
- Clear diagnostics for files that no longer exist on disk before reporting
- Re-index the workspace when it detects file tree changes (e.g., via
workspace/didChangeWatchedFiles) - Invalidate cached diagnostics on branch switch
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗