8000 [REQUEST]: Augmenting compiler diagnostics with hyperlinks and custom actions · Issue #5284 · compiler-explorer/compiler-explorer · GitHub
[go: up one dir, main page]

Skip to content
[REQUEST]: Augmenting compiler diagnostics with hyperlinks and custom actions #5284
@ojeda

Description

@ojeda

Is your feature request related to a problem? Please describe

Compiler Explorer could augment the compiler output with hyperlinks in particular cases, which can improve usability significantly.

For instance, take the rustc compiler. One may get an output like this (https://godbolt.org/z/9KzTzdcs8):

error[E0658]: use of unstable library feature 'num_midpoint'
 --> src/main.rs:2:20
  |
2 |     println!("{}", i32::midpoint(0, 2))
  |                    ^^^^^^^^^^^^^
  |
  = note: see issue #110840 <https://github.com/rust-lang/rust/issues/110840> for more information
  = help: add `#![feature(num_midpoint)]` to the crate attributes to enable

CE already makes part of the error clickable/hoverable (the first two lines). However, this could be taken further, making it easier for the user to browse/apply/... the suggestions/links provided by the compiler without having to copy-paste the suggestions into the source code window, or without having to look up bits in a search engine or to manually craft a URL.

Describe the solution you'd like

Following the example above, the issue is the most obvious one: it could simply be a hyperlink, e.g. (using a Markdown quote here to show the effect):

= note: see issue #110840 https://github.com/rust-lang/rust/issues/110840 for more information

Moreover, the help: could be a "button"/action that adds the line to the source code:

= help: add #![feature(num_midpoint)] to the crate attributes to enable

Finally, the error number could be a link to the documentation of the error:

error[E0658]: use of unstable library feature 'num_midpoint'

These are all done by the Rust Playground, and they are quite useful, e.g. https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=53aa90ef8c8b4605c39042ba6b2c89df

Other CE compilers could implement different augmentations, thus a common/simple way/framework to implement common links/actions would be nice to have.

Describe alternatives you've considered

Instead of simple hyperlinks in the text, one could have custom buttons nearby the lines like some IDEs do (e.g. between lines, or at the left bar, etc.).

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    requestRequest for something

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0