[SAOC 2025] Improve error messages and LSP integration Weekly Update #8
Iskaban10
sourishjana10 at gmail.com
Mon Nov 10 18:29:53 UTC 2025
## [SAOC 2025] Improve error messages and LSP integration Weekly
Update #8
### Work Done
This week, my focus was on exploring and beginning the
integration of DMD’s new -verror-style=lsp flag into the serve-d
language server to enable compiler-grade semantic diagnostics
directly inside editors that use the Language Server Protocol
(LSP).
Serve-d currently provides syntax-level diagnostics using
libdparse, DCD, and Dscanner, but not full semantic errors. My
goal is to allow serve-d to invoke DMD with -verror-style=lsp
after a file save event and forward its JSON-formatted
diagnostics to the editor via LSP.
I focused on:
- Studying serve-d’s internal architecture, focusing on how it
handles LSP requests and file save events (textDocument/didSave).
- Tracing the diagnostics flow inside serve-d — particularly how
it currently collects and publishes diagnostic messages to the
client.
- Understanding how DMD emits diagnostics with the new
-verror-style=lsp flag, and testing it manually from the command
line to verify output format and coverage of semantic errors.
**My future plans are**:
- Hooking into didSave event in server.d to trigger a new
function runSemanticDiagnostics(uri).
- Implementing runSemanticDiagnostics() to spawn DMD with
-verror-style=lsp and collect JSON output.
- Parsing DMD’s output and publishing it to the client via
textDocument/publishDiagnostics.
More information about the Digitalmars-d
mailing list