- 
                Notifications
    You must be signed in to change notification settings 
- Fork 461
Add an optional diagnostic category to diagnostics #2981
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
Conversation
A diagnostic category provides a category name that is used to identify a set of related diagnostics. It can also include a documentation path to provide more information about those diagnostics, to help guide the user in resolving them. Always render a category as [#CategoryName] at the end of the diagnostic message. When we are producing colored output and there is a documentation path, make the category name a hyperlink to the documentation using the OSC 8 scheme.
efd0aeb    to
    01c7c33      
    Compare
  
    | @swift-ci please test | 
| @swift-ci please test macOS | 
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
        
          
                Sources/SwiftDiagnostics/DiagnosticDecorators/ANSIDiagnosticDecorator.swift
          
            Show resolved
            Hide resolved
        
      |  | ||
| /// Forms a hyperlink to the given URL with the given text. | ||
| static func hyperlink(_ text: String, to url: String) -> String { | ||
| "\u{001B}]8;;\(url)\u{001B}\\\(text)\u{001B}]8;;\u{001B}\\" | 
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.
Uh, interesting. I did not know that terminals support hyperlinks. ✨
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.
Wild, eh?
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.
Do you know which terminal applications support this functionality? I don't think it's universal (the VT-100 certainly didn't have the feature.)
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.
Looks like Apple's Terminal.app doesn't support it. Allegedly Konsole doesn't either, although I don't have a copy handy.
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.
(Also, as an aside, you may want to escape both strings.)
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.
There's a list of terminals supporting this at https://github.com/Alhadis/OSC8-Adoption/. Terminal.app doesn't, but it doesn't blow up on it, either; it just shows the text (not the link), which is fine.
Since we're creating a hyperlink to it, we want a URL here.
01c7c33    to
    e3b4abf      
    Compare
  
    | @swift-ci please test | 
| @swift-ci please test Linux | 
| @swift-ci please test Windows | 
0897ff5    to
    d877261      
    Compare
  
    | @swift-ci please test | 
| @swift-ci please test Windows | 
| @swift-ci please test platform Windows | 
| @swift-ci please test macOS | 
| @swift-ci please test Windows | 
| @swift-ci Please test Windows | 
A diagnostic category provides a category name that is used to identify a set of related diagnostics. It can also include a documentation path to provide more information about those diagnostics, to help guide the user in resolving them.
Always render a category as
[#CategoryName]at the end of the diagnostic message. When we are producing colored output and there is a documentation path, make the category name a hyperlink to the documentation using the OSC 8 scheme.