[PR #12286] feat: add OPENCODE_RESPECT_LSP_DIAGNOSTICS flag to ensure LSP diagnostics are always processed #14153

Open
opened 2026-02-16 18:18:57 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/12286

State: open
Merged: No


Summary

  • Add new environment flag OPENCODE_RESPECT_LSP_DIAGNOSTICS=true
  • When enabled, ensures LSP diagnostics are always processed immediately when servers are present
  • Removes TypeScript first-diagnostic skip that was preventing initial diagnostics from appearing
  • Eliminates 150ms debounce delay for immediate diagnostic feedback
  • Increases diagnostic wait timeout from 3s to 30s to accommodate slower LSP responses

Behavior

  • Flag disabled (default): Current behavior unchanged
  • Flag enabled: LSP diagnostics are processed immediately for all language servers
  • Non-intrusive: Only affects diagnostic processing, doesn't override server configurations

Usage

export OPENCODE_RESPECT_LSP_DIAGNOSTICS=true
opencode

Issue Addressed

Fixes #12288 - This addresses the TypeScript first-diagnostic skip issue by ensuring that when LSP servers are running, their diagnostics are always processed rather than being skipped on first publication.

Technical Details

The flag addresses several conditions where LSP diagnostics were being skipped or delayed even when LSP servers were available:

  1. TypeScript First-Diagnostic Skip: The system was ignoring the first diagnostic publication from TypeScript LSP server (affecting .ts, .tsx, .js, .jsx, .mjs, .cjs, .mts, .cts files)
  2. Diagnostic Debounce: 150ms delay was added to all diagnostic publications to wait for follow-up diagnostics
  3. Diagnostic Wait Timeout: 3-second timeout could miss slower LSP responses

Testing

  • TypeScript compilation passes
  • All existing tests continue to pass
  • Manual testing confirms immediate diagnostic processing when flag is enabled

Fixes issue where TypeScript and other language server diagnostics were skipped on first file edit, ensuring immediate feedback when LSP is available.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12286 **State:** open **Merged:** No --- ## Summary - Add new environment flag `OPENCODE_RESPECT_LSP_DIAGNOSTICS=true` - When enabled, ensures LSP diagnostics are always processed immediately when servers are present - Removes TypeScript first-diagnostic skip that was preventing initial diagnostics from appearing - Eliminates 150ms debounce delay for immediate diagnostic feedback - Increases diagnostic wait timeout from 3s to 30s to accommodate slower LSP responses ## Behavior - **Flag disabled (default):** Current behavior unchanged - **Flag enabled:** LSP diagnostics are processed immediately for all language servers - **Non-intrusive:** Only affects diagnostic processing, doesn't override server configurations ## Usage ```bash export OPENCODE_RESPECT_LSP_DIAGNOSTICS=true opencode ``` ## Issue Addressed Fixes #12288 - This addresses the TypeScript first-diagnostic skip issue by ensuring that when LSP servers are running, their diagnostics are always processed rather than being skipped on first publication. ## Technical Details The flag addresses several conditions where LSP diagnostics were being skipped or delayed even when LSP servers were available: 1. **TypeScript First-Diagnostic Skip**: The system was ignoring the first diagnostic publication from TypeScript LSP server (affecting .ts, .tsx, .js, .jsx, .mjs, .cjs, .mts, .cts files) 2. **Diagnostic Debounce**: 150ms delay was added to all diagnostic publications to wait for follow-up diagnostics 3. **Diagnostic Wait Timeout**: 3-second timeout could miss slower LSP responses ## Testing - TypeScript compilation passes - All existing tests continue to pass - Manual testing confirms immediate diagnostic processing when flag is enabled Fixes issue where TypeScript and other language server diagnostics were skipped on first file edit, ensuring immediate feedback when LSP is available.
yindo added the pull-request label 2026-02-16 18:18:57 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14153