[BUG] TypeScript LSP plugin scans file paths in user prompt text, injecting unwanted diagnostics

Resolved 💬 2 comments Opened Feb 25, 2026 by terrylica Closed Mar 25, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

The typescript-lsp@claude-plugins-official plugin parses file paths from user prompt text and automatically opens them for LSP diagnostics. This injects <new-diagnostics> into the conversation context before any tool call is made.

User prompt text is for the LLM to read — the LSP should not scan it for file paths and run diagnostics.

Reproduction

  1. Enable typescript-lsp@claude-plugins-official
  2. Start a Claude Code session in any directory
  3. Submit this prompt:
Look at this file: /path/to/some/real/file.ts

Where the path points to a real .ts file outside the current project.

Expected: No diagnostics. The prompt is text for the LLM. No tool call was made, no file was opened.

Actual: LSP diagnostics are injected immediately:

❯ Look at this file: /path/to/project/extensions/speedreading.ts
  ⎿  ../extensions/speedreading.ts:
  ⎿    ✘ [Line 560:39] Property 'content' does not exist on type 'AgentMessage'. [2339] (typescript)
  ⎿    ✘ [Line 635:38] Property 'content' does not exist on type 'AgentMessage'. [2339] (typescript)
  ⎿    ✘ [Line 668:68] Argument of type '"success"' is not assignable to parameter of type ... [2345] (typescript)
  ⎿    ✘ [Line 678:15] Property 'handler' does not exist on type 'SlashCommandInfo'. [2339] (typescript)
  ⎿    ★ [Line 176:10] 'startTime' is declared but its value is never read. [6133] (typescript)

Controlled Test

| Prompt | Diagnostics injected? | Expected? |
|--------|----------------------|-----------|
| Look at this file: /absolute/path/to/file.ts | YES — diagnostics injected before any tool call | NO |
| The file ../relative/path/file.ts has some import issues I want to discuss conceptually. | No | Correct |
| Read /absolute/path/to/file.ts (triggers Read tool) | Diagnostics after Read tool completes | Acceptable |

Why This Is Wrong

  1. User prompt is for the LLM, not the LSP. Mentioning a file path in natural language should not trigger file opens or diagnostics.
  2. Cross-project pollution. The referenced file is outside the current project's tsconfig.json scope, so diagnostics may be inaccurate (missing node_modules, wrong compiler options).
  3. Context waste. Diagnostics consume tokens and distract the model into attempting "fixes" the user never asked for.
  4. Breaks user intent. The user may want to discuss the file conceptually without triggering analysis.

Suggested Fix

The LSP plugin should only open files and run diagnostics in response to tool calls (Read, Edit, Write), not by parsing file paths from user prompt text.

Related Issues

  • #22335 — LSP plugins spawn eagerly regardless of file types in project
  • #26634 — pyright-lsp promotes hint-level diagnostics into conversation context

Environment

  • Claude Code: 2.1.56
  • Plugin: typescript-lsp@claude-plugins-official
  • OS: macOS Darwin 24.6.0 (arm64)

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗