-
Notifications
You must be signed in to change notification settings - Fork 834
FSharpDiagnostic: add default severity #19152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
❗ Release notes required
|
Martin521
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes a lot of sense.
The whole diagnostics logging area is so over-complicated. I welcome every step to simplify it.
auduchinok
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
| | FSharpDiagnosticSeverity.Hidden -> [] | ||
| | adjustedSeverity -> | ||
|
|
||
| let diagnostic = { diagnostic with Severity = adjustedSeverity } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without reading the implementation, I had problems imagining what default meant in the context of F.C.S public API.
Did you consider other names?
OriginalSeverity or UnadjustedSeverity perhaps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the current naming makes sense. Maybe an XmlDoc would be sufficient? We could then leave the current name. If not, I'd vote for OriginalSeverity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PhasedDiagnostic is not part of the public API, so I would keep it here as is.
See my comment below for the public API.
| | FSharpDiagnosticSeverity.Hidden -> [] | ||
| | adjustedSeverity -> | ||
|
|
||
| let diagnostic = { diagnostic with Severity = adjustedSeverity } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PhasedDiagnostic is not part of the public API, so I would keep it here as is.
See my comment below for the public API.
| member Severity: FSharpDiagnosticSeverity | ||
|
|
||
| /// Gets the default severity, does not take into account diagnostics options | ||
| member DefaultSeverity: FSharpDiagnosticSeverity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the original severity should be publicly accessible. It is an implementation detail. The adjusted severity is the specified output of the compiler (after applying the different flags and directives) and should be the only visible one.
This API allows the IDE to differentiate compiler errors from warnings. Useful, for example, for suggesting actions like adding a #nowarn directive.