Skip to content
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

Narratable report handler produces bad output with labels including EOL or EOF #220

Open
Benjamin-L opened this issue Nov 3, 2022 · 0 comments

Comments

@Benjamin-L
Copy link
Contributor

The graphical report handler supports spans that include the EOL (or, at least, it will once #215 is fixed). These are rendered like this:

Source: source\ntext\n here
Span: (7, 5)

Error: oops::my::bad

  × oops!
   ╭─[bad_file.rs:1:1]
 1 │ source
 2 │ text
   · ──┬──
   ·   ╰── this bit here
 3 │   here
   ╰────
  help: try doing it better next time?

Passed the same input, the narratable handler produces:

Error: oops!
    Diagnostic severity: error
Begin snippet for bad_file.rs starting at line 1, column 1

snippet line 1: source
snippet line 2: text
    label starting at line 2, column 1: this bit here
snippet line 3:   here
    label ending at line 3, column 0: this bit here
diagnostic help: try doing it better next time?
diagnostic code: oops::my::bad

When the span extends past EOF, the result is:

Source: source\ntext
Span: (7, 5)

Error: oops!
    Diagnostic severity: error
Begin snippet for bad_file.rs starting at line 1, column 1

snippet line 1: source
snippet line 2: text
    label starting at line 2, column 1: this bit here
diagnostic help: try doing it better next time?
diagnostic code: oops::my::bad

With a trailing newline on the source input:

Source: source\ntext\n
Span: (7, 5)

Error: oops!
    Diagnostic severity: error
Begin snippet for bad_file.rs starting at line 1, column 1

snippet line 1: source
snippet line 2: text
    label at line 2, columns 1 to 4: this bit here
diagnostic help: try doing it better next time?
diagnostic code: oops::my::bad

All three of these cases should probably be rendered as label at line 2, columns 1 to 5: this bit here. When solving this, we should consider the edge cases from #215 (comment) as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant