Skip to content

v0.8.6 feat: inline LSP diagnostics — surface rust-analyzer/pyright/etc. errors in tool output #389

@Hmbown

Description

@Hmbown

Pitch

opencode parity. We have `crates/tui/src/lsp/` foundation (#136) but it isn't surfaced in the transcript yet. After every `apply_patch` / `edit_file` / `write_file`, send a `textDocument/didChange` to the LSP server and wait briefly (~300ms) for diagnostics. Render any errors / warnings inline below the patch result:

```
✓ apply_patch crates/tui/src/foo.rs

  • 5 lines
    ⚠ rust-analyzer · 1 error · 1 warning
    foo.rs:12:9 expected ;, found }
    foo.rs:18:5 unused variable: x
    ```

The model sees these in the next turn (already in the tool result text), so it can self-correct without the user having to paste the build error.

Implementation sketch

  • LSP server discovery already exists; just poll `pull_diagnostics` after each patching tool call.
  • Cap diagnostic rendering at 5 most-severe entries per file.
  • Setting to disable for users on slow LSP servers (`/config diagnostics_inline false`).

Acceptance

  • Patching a Rust file with a syntax error shows the error inline in the tool result.
  • Diagnostics auto-clear when the next patch fixes them.
  • No regression for languages without an LSP installed.
  • Setting toggle works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestv0.8.6Targeting v0.8.6

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions