claude-code - 💡(How to fix) Fix typescript-lsp plugin reports diagnostics for files that no longer exist after branch switch [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#47928Fetched 2026-04-15 06:38:21
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×5commented ×1

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.

Root Cause

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.

RAW_BUFFERClick to expand / collapse

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

  1. Install the typescript-lsp plugin
  2. Work on a branch that has certain TypeScript files (e.g., build-default.ts, project-to-current-vis-shape.ts)
  3. Switch to a different branch where those files don't exist
  4. 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-official enabled
  • 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

extent analysis

TL;DR

The typescript-lsp plugin needs to clear diagnostics for non-existent files or re-index the workspace after a git branch switch to prevent noisy diagnostic notifications.

Guidance

  • Investigate the typescript-lsp plugin's configuration to see if there's an option to automatically clear diagnostics for files that no longer exist on disk.
  • Consider using the workspace/didChangeWatchedFiles event to trigger a re-index of the workspace when file tree changes are detected.
  • Look into invalidating cached diagnostics when a branch switch is detected to prevent outdated diagnostics from being reported.
  • Verify that the typescript-language-server version (v5.1.3) is compatible with the typescript-lsp plugin and Claude Code.

Example

No code snippet is provided as the issue is more related to plugin configuration and behavior.

Notes

The solution may require modifications to the typescript-lsp plugin or its configuration, and may not be directly applicable to other plugins or environments.

Recommendation

Apply a workaround by manually clearing diagnostics for non-existent files or re-indexing the workspace after a git branch switch, as a permanent fix may require updates to the typescript-lsp plugin.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

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

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING