anthropics / anthropics/claude-code
LSP: hint-severity (tagged unnecessary) diagnostics are pushed into model context as new-diagnostics — token waste, no way to filter
- Dominant language
- TypeScript
- Stars
- 146k
- Forks
- 23.8k
- PR merge metrics
- PR metrics pending
Description
### Summary
> **Edit:** an earlier version of this issue claimed `pyright.disableTaggedHints` is a client-only (VS Code extension) setting. That was wrong — I had grepped the thin `pyright-langserver.js` loader instead of the `pyright-internal` bundle. The setting **is implemented server-side** (it filters tagged diagnostics out of `publishDiagnostics` and is re-read on `workspace/didChangeConfiguration`). The remaining gap is that Claude Code exposes **no configuration surface** to set it; issue retargeted accordingly.
With an LSP plugin enabled (official `pyright-lsp`), every Edit/Write of a Python file pushes **hint-severity diagnostics** into the model context as `` system reminders. Pyright emits hints for intentionally-unused parameters (the standard underscore convention in test stubs), so ordinary test-driven work produces a steady drip of ★-marked lines like:
```
⎿ ★ [Line 161:19] "_a" is not accessed (Pyright)
⎿ ★ [Line 161:25] "_kw" is not accessed (Pyright)
⎿ ★ [Line 286:41] "_p" is not accessed (Pyright)
⎿ ★ [Line 593:44] "capsys" is not accessed (Pyright)
⎿ ★ [Line 954:31] "_kwargs" is not accessed (Pyright)
⎿ ★ [Line 1010:18] "_prompt" is not accessed (Pyright)
```
These are pushed as part of the conversation context, so every one of them is paid for on every subsequent turn — pure token waste with no actionable content for the model.
### Why this is noise, not signal
- Running the same files through the pyright **CLI** (`pyright file.py`, defaults) reports **0 errors, 0 warnings, 0 informations** — these unused-parameter findings don't even exist in CLI output. They are a language-server-only hint layer.
- In VS Code the same diagnostics render as faded text (tag `Unnecessary`), not as problems. They are editor affordances, not defects.
- The underscore convention (`lambda _items, **_kw: "0"` to stub `select_from_menu`) is standard Python style for "intentionally unused", and the hint layer flags those names anyway.
### Why there is no durable workaround today
1. The server-side fix exists: `pyright.disableTaggedHints: true` (in the `pyright` settings section, honored via `initializationOptions`/`didChangeConfiguration`). If it could be set, pyright would simply stop publishing the tagged hints.
2. But Claude Code provides **no way to set it**: the `settings`/`initializationOptions` fields of `lspServers.*` can only be declared in the plugin's manifest / marketplace entry — there is no user-level LSP key in `settings.json` (settings docs expose none; in the 2.1.278 binary `lspServers` appears only as plugin-manifest schema and plumbing). Hand-editing the marketplace snapshot (`~/.claude/plugins/marketplaces/claude-plugins-official/.claude-plugin/marketplace.json`) works until the marketplace refreshes and overwrites the edit.
3. The plugin manifest's `lspServers.*.diagnostics` option is all-or-nothing (`true`/`false`): turning it off also silences real errors and warnings.
### Requested fix
Any one of these would solve it:
1. A user-level way to configure LSP server settings for enabled plugins — e.g. a `settings.json` key that merges into / overrides a plugin's `lspServers.*` config (`settings`/`initializationOptions`), so `pyright.disableTaggedHints: true` can be set durably.
2. **Default change (preferred where applicable):** don't push hint-severity diagnostics into context — push `error`/`warning`/`information` only. Hints exist for human editors.
3. Extend the plugin manifest's `lspServers.*.diagnostics` beyond a boolean (e.g. `diagnostics: { minSeverity: "warning", taggedHints: false }`).
(Also worth considering on the content side: an upstream PR to `anthropics/claude-plugins-official` adding `settings: { pyright: { disableTaggedHints: true } }` to the `pyright-lsp` entry would fix this plugin for everyone.)
### Environment
- Claude Code 2.1.278 (native install), macOS (Darwin 25.6.0)
- Plugin: `pyright-lsp@claude-plugins-official` 1.0.0
- Language server: pyright 1.1.410 (npm global)
Reproduction: enable `pyright-lsp`, open a session in any Python repo, write/edit a file containing a test stub such as `monkeypatch.setattr("mod.fn", lambda _items, **_kw: "0")` — observe the ★ hint lines arrive in context as ``.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the lspServers.* settings and initializationOptions plumbing, then inspect the plugin manifest schema and the settings documentation mentioned in the report. Compare how pyright.disableTaggedHints is passed through didChangeConfiguration and how diagnostics are emitted. Done means a durable user-level configuration or documented severity filtering path that prevents hint-only diagnostics from reaching model context without hiding errors and warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100