Thread overview
# [SAoC 2025] Improving D error messages Weekly Update #3
Oct 06
Iskaban10
Oct 08
Serg Gini
6 days ago
Iskaban10
October 06

Summary

This week, I focused on DMD’s diagnostic and error reporting infrastructure as part of enabling Language Server Protocol (LSP) integration. The main goal was to produce structured diagnostic data in JSON format that can be easily consumed by editors or tools such as serve-d and code-d.

1. Studied DMD’s Diagnostic System

  • Understood how ErrorSink acts as an abstraction layer for all compiler messages (error, warning, deprecation, etc.).
  • Traced how diagnostics propagate from parsing and semantic analysis to the sink layer.

2. Analysed Existing Tooling

  • Examined D’s existing ecosystem components: serve-d and code-d for LSP support.
  • Studied sarif.d and json.d in the DMD codebase.
  • Found that sarif.d is designed for static analysis report generation, not for real-time LSP diagnostics.

3. Implemented errorsinkjson.d

  • Created a new module errorsinkjson.d defining the class ErrorSinkJson.
  • ErrorSinkJson inherits from ErrorSink and overrides all relevant virtual methods.
  • Each diagnostic is serialized into JSON with fields like:
    {
        "type": "error",
        "file": "main.d",
        "line": 42,
        "column": 5,
    }
    

Work in : https://github.com/Iskaban10/dmd/tree/lsp

October 08

On Monday, 6 October 2025 at 14:10:48 UTC, Iskaban10 wrote:

>

Summary

This week, I focused on DMD’s diagnostic and error reporting infrastructure as part of enabling Language Server Protocol (LSP) integration. The main goal was to produce structured diagnostic data in JSON format that can be easily consumed by editors or tools such as serve-d and code-d.

Thanks for improving these things!

From my perspective this task is crucial for language adoption

Even big and successful languages are improving on this.
Maybe you will find some inspiration from new Python as well

https://realpython.com/python314-error-messages/

6 days ago
On Wednesday, 8 October 2025 at 08:14:01 UTC, Serg Gini wrote:
> On Monday, 6 October 2025 at 14:10:48 UTC, Iskaban10 wrote:
>> ## Summary
>> This week, I focused on DMD’s diagnostic and error reporting infrastructure as part of enabling Language Server Protocol (LSP) integration. The main goal was to produce structured diagnostic data in JSON format that can be easily consumed by editors or tools such as `serve-d` and `code-d`.
>
>
> Thanks for improving these things!
>
> From my perspective this task is crucial for language adoption
>
> Even big and successful languages are improving on this.
> Maybe you will find some inspiration from new Python as well
>
> https://realpython.com/python314-error-messages/

Thanks for your reply. Will surely look into the reference.