Skip to content

Snippets without a path don't have a proper group start (unicode) #244

Closed
@epage

Description

@epage
#!/usr/bin/env nargo
---
[dependencies]
annotate-snippets.git = "https://github.com/rust-lang/annotate-snippets-rs.git"
---

use annotate_snippets::{renderer::OutputTheme, AnnotationKind, Group, Level, Renderer, Snippet};

fn main() {
    // Taken from: https://docs.python.org/3/library/typing.html#annotating-callable-objects
    let source = "def __call__(self, *vals: bytes, maxlen: int | None = None) -> list[bytes]: ...";
    let group = Group::with_title(Level::ERROR.title("")).element(
        Snippet::source(source).annotation(AnnotationKind::Primary.span(4..12).label("annotation")),
    );

    println!(
        "{}",
        Renderer::styled()
            .theme(OutputTheme::Unicode)
            .term_width(83)
            .render(&[group])
    );
}

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions