www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23309] New: diagnostics: add more expressive endpoints than

https://issues.dlang.org/show_bug.cgi?id=23309

          Issue ID: 23309
           Summary: diagnostics: add more expressive endpoints than just
                    error and supplemental
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

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());

--
Aug 28 2022