mirror of
https://github.com/astral-sh/ruff
synced 2026-01-10 08:04:26 -05:00
ruff_annotate_snippets: support overriding the "cut indicator"
We do this because `...` is valid Python, which makes it pretty likely that some line trimming will lead to ambiguous output. So we add support for overriding the cut indicator. This also requires changing some of the alignment math, which was previously tightly coupled to `...`. For Ruff, we go with `…` (`U+2026 HORIZONTAL ELLIPSIS`) for our cut indicator. For more details, see the patch sent to upstream: https://github.com/rust-lang/annotate-snippets-rs/pull/172
This commit is contained in:
committed by
Andrew Gallant
parent
a45f4de683
commit
84ba4ecaf5
@@ -210,7 +210,7 @@ impl std::fmt::Display for CodeFrame<'_> {
|
||||
.annotation(annotation)
|
||||
.fold(false);
|
||||
let message = Level::None.title("").snippet(snippet);
|
||||
let renderer = Renderer::plain();
|
||||
let renderer = Renderer::plain().cut_indicator("…");
|
||||
let rendered = renderer.render(message);
|
||||
writeln!(f, "{rendered}")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user