Skip to content

feat(opencode): surface lsp diagnostics on read#16592

Open
mmsaki wants to merge 3 commits intoanomalyco:devfrom
mmsaki:feat/lsp-diagnostics-read
Open

feat(opencode): surface lsp diagnostics on read#16592
mmsaki wants to merge 3 commits intoanomalyco:devfrom
mmsaki:feat/lsp-diagnostics-read

Conversation

@mmsaki
Copy link
Copy Markdown

@mmsaki mmsaki commented Mar 8, 2026

Issue for this PR

Closes #16569

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds a diagnostics operation to the built-in lsp tool and updates read to surface current-file LSP diagnostics when a language server is available.
The lsp tool now accepts file-level diagnostics without requiring line/character, while position-based operations still require them. The read tool now attaches warning/error diagnostics for the current file as a best-effort enhancement and keeps normal read behavior if diagnostics lookup fails.

How did you verify your code works?

  • Ran bun test test/tool/read.test.ts test/tool/lsp.test.ts in packages/opencode
  • Ran bun run typecheck in packages/opencode
  • Manually tested the built binary to confirm:
    • read surfaces diagnostics for supported file types
    • lsp diagnostics works without positional arguments

Screenshots / recordings

openode-diagnostics.mp4

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@mmsaki mmsaki force-pushed the feat/lsp-diagnostics-read branch from 20659a7 to 74585fd Compare March 8, 2026 11:27
@mmsaki
Copy link
Copy Markdown
Author

mmsaki commented Mar 10, 2026

@thdxr is this a valid contribution see demo?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Expose LSP diagnostics as a tool and auto-surface them on read

1 participant