Skip to content

feat(lsp): auto-attach diagnostics to edit results (closes #428)#656

Closed
merchloubna70-dot wants to merge 4 commits into
Hmbown:mainfrom
merchloubna70-dot:feat/lsp-auto-diagnostics-428
Closed

feat(lsp): auto-attach diagnostics to edit results (closes #428)#656
merchloubna70-dot wants to merge 4 commits into
Hmbown:mainfrom
merchloubna70-dot:feat/lsp-auto-diagnostics-428

Conversation

@merchloubna70-dot

Copy link
Copy Markdown

After every successful apply_patch / write_file / edit_file, query LspManager and append <diagnostics> block to tool result. Gated behind existing [lsp] enabled config flag. Closes #428


wangfengcsu@qq.com

macworkers and others added 3 commits May 4, 2026 12:39
All system prompts were English-only, causing DeepSeek V4 to reason
and respond in English even when users wrote in Chinese or other
languages.

Add a Language Mirror section to base.md and base.txt that instructs
the model to detect the user's primary language and use it for both
reasoning (thinking tokens) and the final reply.
base.txt is not referenced via include_str! in prompts.rs.
Only base.md is loaded (BASE_PROMPT). Remove the redundant change
to base.txt as noted by Gemini Code Assist review.
After every successful apply_patch / write_file / edit_file the engine
queries LspManager for diagnostics on touched files and appends a
<diagnostics file="…"> block to the tool result.

- ToolContext gains optional lsp_manager field + with_lsp_manager() builder
- lsp_diagnostics_for_paths() helper handles async fan-out and rendering
- All three edit tools append the block when non-empty
- Gated behind existing [lsp] enabled config flag; silent fallback

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@ILoveScratch2

Copy link
Copy Markdown

谁家PR机器人

@Hmbown

Hmbown commented May 5, 2026

Copy link
Copy Markdown
Owner

Triple-check finding: parallel LSP path is dead code

The PR adds lsp_manager field to ToolContext and with_lsp_manager() builder with #[allow(dead_code)]. But the engine's build_tool_context never calls with_lsp_manager — the field is always None at runtime.

Separately, the engine-level LSP path (run_post_edit_lsp_hookflush_pending_lsp_diagnostics in lsp_hooks.rs) is fully wired and functional. So the feature works — just through the engine path, not the tool-context path this PR added.

The tool-context path was intended for tools to also auto-inject diagnostics, but was never activated. The #[allow(dead_code)] annotation confirms the author knew this was pending work.

Recommendation: Either wire with_lsp_manager into build_tool_context or remove the dead tool-context path and rely solely on the working engine-level hooks. Both paths aren't needed — the engine hooks already achieve the same thing.

…-up)

The `with_lsp_manager()` builder and `lsp_manager` ToolContext field
existed but were never populated in production — `build_tool_context`
always left the field as `None`. Wire `self.lsp_manager.clone()` into
the context builder so edit tools can auto-inject diagnostics via the
tool-context path in addition to the engine-level LSP hook.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@merchloubna70-dot

Copy link
Copy Markdown
Author

Fixed — added .with_lsp_manager(self.lsp_manager.clone()) to the builder chain in build_tool_context so the field is populated at runtime, and removed the #[allow(dead_code)] from with_lsp_manager.

Hmbown added a commit that referenced this pull request May 5, 2026
47 fmt drifts had accumulated from the squash-merged community PRs on
this branch (#653, #654, #655, #645, #658, #668, #659, #661, #660,
#667, #656). Pure formatting — no behavioural changes — applied via
`cargo fmt --all` to satisfy CI's `cargo fmt --all -- --check` gate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
kibuniverse pushed a commit to kibuniverse/DeepSeek-TUI that referenced this pull request May 5, 2026
MMMarcinho pushed a commit to MMMarcinho/DeepSeek-TUI that referenced this pull request May 6, 2026
MMMarcinho pushed a commit to MMMarcinho/DeepSeek-TUI that referenced this pull request May 6, 2026
47 fmt drifts had accumulated from the squash-merged community PRs on
this branch (Hmbown#653, Hmbown#654, Hmbown#655, Hmbown#645, Hmbown#658, Hmbown#668, Hmbown#659, Hmbown#661, Hmbown#660,
Hmbown#667, Hmbown#656). Pure formatting — no behavioural changes — applied via
`cargo fmt --all` to satisfy CI's `cargo fmt --all -- --check` gate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Hmbown

Hmbown commented May 23, 2026

Copy link
Copy Markdown
Owner

This PR was opened before the v0.8.41 rebrand and is now stale. Feel free to rebase onto current main and reopen. 鲸鱼兄弟们等你 🐋

@Hmbown Hmbown closed this May 23, 2026
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.

OPENCODE: LSP diagnostics auto-attached to edit results

3 participants