What we have is good enough for simple diagnostics on the console, but there is a attach more useful information to a message, that could be emitted at more verbose diagnostic levels.
Where we've seen PRs that try to do something different.
- Splitting errors into multiple lines:
https://github.com/dlang/dmd/pull/12526
See PR for possible way to do this.
- Tagging errors with documentation links (gdc has -fdiagnostics-urls)
https://github.com/dlang/dmd/pull/14354
A new diagnostic function could be added that only emits to the console when requested.
eg: specSupplemental("lex.html#floatliteral");
Requested features from people in the wild/community/industry.
- Underline and use caret in errors (gdc has -fdiagnostics-show-caret)
No special endpoint is required, but we would need all expressions to have start and end location ranges for underlining to work properly.
- Generating patches in unified diff format for fixing code (gdc has -fdiagnostics-generate-patch)
A new diagnostic function could be added for the "did you mean" style errors, passing the location range and suggestion for fixing.
eg: hintSupplemental(locstart, locend, "struct");
hintSupplemental(locstart, locend, s.toChars());
Comment #1 by robert.schadek — 2024-12-13T19:24:15Z