-
Notifications
You must be signed in to change notification settings - Fork 428
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
[Diagnostic formatting] Add a category footnote printer #3007
Conversation
Categories associated with diagnostics are printed in a Markdown link style as part of diagnostics (e.g., `[#StrictMemorySafety]`). At the end of compilation, a tool may wish to provide documentation links to documentation for all of the categories that showed up in that compilation. This new function DiagnosticFormatter.categoryFootnotes() prints the categories it is given (also as Markdown) for that purpose, e.g., [#deprecated]: <http://example.com/deprecated> [#StrictMemorySafety]: <http://example.com/memory-safety>
@swift-ci please test |
@swift-ci please test |
@swift-ci please test Windows |
Speculatively merging; we can revise as needed |
/// [#categoryName]: <categoryDocumentationURL> | ||
/// ``` | ||
/// | ||
/// This function also deduplicates entries and alphabetizes the results. |
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.
Nice, worth doing that 👍
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.
Just one suggestion, otherwise LGTM. 👍🏽
/// - leadingText: text that is prefixed to the list of categories when | ||
/// there is at least one category to print. | ||
public func categoryFootnotes( | ||
_ categories: [DiagnosticCategory], |
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.
Could we make this some Collection<DiagnosticCategory>
, say if somebody collected the categories in a Set
(which doesn’t seem too unreasonable to me).
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.
Great idea! #3008
Categories associated with diagnostics are printed in a Markdown link style as part of diagnostics (e.g.,
[#StrictMemorySafety]
). At the end of compilation, a tool may wish to provide documentation links to documentation for all of the categories that showed up in that compilation. This new function DiagnosticFormatter.categoryFootnotes() prints the categories it is given (also as Markdown) for that purpose, e.g.,