Uh oh!
There was an error while loading. Please reload this page.
Diagnostics: Clearer information style - #17488
Conversation
|
i-shm
commented
Aug 5, 2024
@dotnet-policy-service agree |
* Add file content to message. * Use more symbols and line breaks to separate messages.
94272d6 to
4c79188Compare@DedSec256 had a bunch of changes made to diagnostics context some time ago, maybe he has a couple of thoughts and ideas. In general - we want to kept few things in mind:
In conclusion - thanks for that, we do want to make diagnostics prettier and add more context to them, but I think we want a more systematic approach. |
vzarytovskii
commented
Aug 5, 2024
Wanted to expand of one of the points - a separate diagnostic style - it will certainly help to not change 100s of tests which match directly on the output, and will allow us to test things separately and make sure we didn't accidentally break anything in the process. |
psfinaki
commented
Aug 5, 2024
@muqiuhan thanks for your first PR - welcome to the F# world 😎 We'll indeed need to discuss this one in a broader context since diags are a very complex topic. Meanwhile, if you are interested in it, feel free to address any of these problems we've already agreed on, some of them are great to get hands dirty here and we'll be happy to guide you and help you with them :) |
i-shm
commented
Aug 5, 2024
i-shm
commented
Aug 5, 2024
Thanks for the tip! I will try to participate in solving these problems ^_^ |
vzarytovskii
commented
Aug 5, 2024
vzarytovskii
commented
Aug 5, 2024
If you would like to, I can make this change in your branch (maybe later this week), to demonstrate what I mean. |
I understand what you mean, you expressed it very clearly, it's a great idea! like this: /// Represents the style being used to format errors[<RequireQualifiedAccess>]typeDiagnosticStyle=| Default
| Rich
...Then add it elsewhere: match tcConfig.diagnosticStyle with| DiagnosticStyle.Emacs ->...| DiagnosticStyle.Default ->...| DiagnosticStyle.Rich ->...... |
Uh oh!
There was an error while loading. Please reload this page.
vzarytovskii
commented
Aug 5, 2024
Yep, precisely. And then we can add a new compiler flag, which will be selecting |
T-Gro
commented
Aug 15, 2024
@muqiuhan : I have marked the PR as a draft to avoid accidental merging. Once this is done as a new DiagnosticsStyle (per the suggestion from Vlad above), this will be ready for merge. |
vzarytovskii
commented
Aug 25, 2024
I intend to add a flag tomorrow so we can maybe start testing it sooner? It should take me a couple of hours. I will add a new format for the diagnostic and make tests green (won't be adding any tests now). Let me know if anyone has any objections. |
vzarytovskii
commented
Aug 26, 2024
baronfel
commented
Aug 26, 2024
(me and @rainersigwald right now) We're going to be watching what y'all do from the perspective of "what information would a compiler need to give to MSBuild in order for MSBuild to be able to render a message as nicely as this". |
Currently, I'm going to test it with FSI, thought it's applicable to msbuild(fsc) as well. |
edgarfgp
commented
Aug 26, 2024
Great job @muqiuhan and @vzarytovskii. I’m looking forward to see what is next here. |
vzarytovskii
commented
Aug 26, 2024
Happy to merge it if everyone agrees, to start working on some format adjustments |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
psfinaki
left a comment
There was a problem hiding this comment.
These bubbles looks weird to me really - but it's a good move anyway.
vzarytovskii
commented
Aug 26, 2024
Yea, it's just "make it work" PR |
psfinaki
commented
Aug 26, 2024
Leaving the merge on you here, in case you want anyone else to take a look. |




Description
In this PR, I tried to make some changes to CompilerDiagnostics.fs to make the compiler print clearer error messages (or warning messages, etc.)
I tried adding a Context field to
FormattedDiagnosticDetailedInfo, which reads the corresponding content from the target file according to the information range indicated by the Range type, and then adds it tobufinPhasedDiagnostic.This is my first time entering the world of the F# compiler, and I know this PR has a lot of issues, but I would like to put forward a small idea about #14832 . ^_^
Checklist