You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
rust-lang/annotate-snippets-rs#172
let body = format_message(message, term_width, anonymized_line_numbers,true);
127
+
let body = format_message(
128
+
message,
129
+
term_width,
130
+
anonymized_line_numbers,
131
+
cut_indicator,
132
+
true,
133
+
);
124
134
125
135
Self{
126
136
body,
127
137
stylesheet,
128
138
anonymized_line_numbers,
139
+
cut_indicator,
129
140
}
130
141
}
131
142
@@ -143,6 +154,7 @@ impl<'a> DisplayList<'a> {
143
154
multiline_depth,
144
155
self.stylesheet,
145
156
self.anonymized_line_numbers,
157
+
self.cut_indicator,
146
158
buffer,
147
159
)?;
148
160
}
@@ -270,6 +282,7 @@ impl DisplaySet<'_> {
270
282
}
271
283
272
284
// Adapted from https://github.com/rust-lang/rust/blob/d371d17496f2ce3a56da76aa083f4ef157572c20/compiler/rustc_errors/src/emitter.rs#L706-L1211
0 commit comments