Skip to content

Code previews in diagnostics #14832

@ghost

Description

Is your feature request related to a problem? Please describe.

F#'s diagnostics are currently single-line brief descriptions with a span and a file id.

image

This is quite tedious, especially if you're actively working with the dotnet CLI through a terminal. It doesn't really give you an insight on where the issue occurs and forces the developer into spawning an editor and finding the location manually.

Describe the solution you'd like

The output containing a preview into the source code, with additional metadata and information pointed across spans. Even in simple cases, this is already quite an improvement. But in more complex cases, it can be particularly helpful.

Consider a hypothetical diagnostic such as this (Image : zesterer/ariadne, diagnostic library in Rust)
image

But this also inherently supports and encourages better, more supporting diagnostics into the compiler.

(Image : Rustc suggesting the proper keyword to use)

image

Additional Context

I would be most glad to implement this into the F# compiler. Bringing my (relatively small, but not insignificant) experience working around with Rustc's diagnostics and working with Ariadne into the F# compiler. =)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions