Skip to content

feat: add OPENCODE_RESPECT_LSP_DIAGNOSTICS flag to ensure LSP diagnostics are always processed#12286

Open
lmn451 wants to merge 1 commit intoanomalyco:devfrom
lmn451:feat/respect-lsp-diagnostics
Open

feat: add OPENCODE_RESPECT_LSP_DIAGNOSTICS flag to ensure LSP diagnostics are always processed#12286
lmn451 wants to merge 1 commit intoanomalyco:devfrom
lmn451:feat/respect-lsp-diagnostics

Conversation

@lmn451
Copy link

@lmn451 lmn451 commented Feb 5, 2026

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.

…tics are always processed

- Add new environment flag OPENCODE_RESPECT_LSP_DIAGNOSTICS
- Remove TypeScript first-diagnostic skip when flag is enabled
- Set diagnostic debounce to 0ms when flag is enabled
- Increase diagnostic wait timeout to 30s when flag is enabled
- Ensures all LSP servers' diagnostics are immediately processed when available
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LSP diagnostics are skipped or delayed under multiple conditions

1 participant