-
Notifications
You must be signed in to change notification settings - Fork 0
Feedback #1
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
Conversation
Pull Request Test Coverage Report for Build 14500512388Details
💛 - Coveralls |
6240e15
to
ed8dfa6
Compare
examples/footer.svg
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note:
doesn't get colored?
examples/format.svg
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes seem to be
- We now bold the
:
inerror:
- We will no longer color the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If its not too much trouble, could this be hacked in to the old renderer in a commit before so the test changes are easier to see?
examples/multislice.svg
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We added a blank line between the first snippet and :::
examples/expected_type.svg
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are now folding lines between annotations
src/renderer/mod.rs
Outdated
use margin::Margin; | ||
use std::fmt::Display; | ||
use rustc_hash::{FxHashMap, FxHasher}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we consider making this an optional feature or removing it?
src/snippet.rs
Outdated
/// Primary structure provided for formatting | ||
/// | ||
/// See [`Level::title`] to create a [`Message`] | ||
#[derive(Debug)] | ||
#[derive(Clone, Debug)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you split API changes like this into a commit before hand?
examples/multislice.svg
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactor: Right align line numbers
That is not a refactor if its user visible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactor: Move to new API
its not a refactor if its user visible.
This is also a breaking change and should be called out
.label("expected enum `std::option::Option`"), | ||
), | ||
let message = Level::Error.message("mismatched types").id("E0308").group( | ||
Group::new().element( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain the new API in the commit or PR?
For example, why was a Group
container chosen over group
accepting a Vec
or IntoIterator
src/snippet.rs
Outdated
fn newline_count(body: &str) -> usize { | ||
#[cfg(feature = "simd")] | ||
{ | ||
memchr::memchr_iter(b'\n', body.as_bytes()) | ||
.count() | ||
.saturating_sub(1) | ||
} | ||
#[cfg(not(feature = "simd"))] | ||
{ | ||
body.lines().count().saturating_sub(1) | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, implementation details should be at the end.
@@ -38,104 +35,178 @@ impl<'a> Message<'a> { | |||
self | |||
} | |||
|
|||
pub fn snippet(mut self, slice: Snippet<'a>) -> Self { | |||
self.snippets.push(slice); | |||
pub fn group(mut self, group: Group<'a>) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the places where we deal with groups, we'll need to explain the difference between a single group vs many groups. Unsure whether a suggested policy belongs in this package or somewhere else but at least Cargo and Rustc will need to be consistent
src/snippet.rs
Outdated
.map(|a| a.range.start) | ||
.min() | ||
.unwrap_or(0); | ||
pub fn needs_col_separator(mut self, needs_col_separator: bool) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What role does this serve?
src/snippet.rs
Outdated
self | ||
} | ||
|
||
pub fn annotations(mut self, annotation: impl IntoIterator<Item = Annotation<'a>>) -> Self { | ||
self.annotations.extend(annotation); | ||
pub fn col_separator(mut self, col_separator: bool) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this?
src/snippet.rs
Outdated
Primary, // in rustc terms, "primary"; color to message's level | ||
Context, // in rustc terms, "secondary"; fixed color | ||
// Level(Level), // from old API, dropped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use doc comments
src/snippet.rs
Outdated
pub fn primary(mut self, primary: bool) -> Self { | ||
self.primary = primary; | ||
self | ||
} | ||
|
||
pub fn standalone(mut self, standalone: bool) -> Self { | ||
self.standalone = standalone; | ||
self | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are these?
pub fn line(mut self, line: usize) -> Self { | ||
self.line = Some(line); | ||
self | ||
} | ||
|
||
pub fn char_column(mut self, char_column: usize) -> Self { | ||
self.char_column = Some(char_column); | ||
self | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are new. How do they relate to the rest of the API?
Should we make new parts of the API an extra commit on top of the existing API for easier comparison and discussion?
src/snippet.rs
Outdated
impl<'a> From<Snippet<'a, Annotation<'a>>> for Element<'a> { | ||
fn from(value: Snippet<'a, Annotation<'a>>) -> Self { | ||
Element::Cause(value) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd put all of these From
s next to Element
as this is about defining how to interact with an Element
and not each of the other types
} | ||
|
||
pub(crate) fn is_deletion(&self, sm: &SourceMap<'_>) -> bool { | ||
self.replacement.trim().is_empty() && self.replaces_meaningful_content(sm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why trim
and only on this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add these tests in a prior commit, either without the patches or using annotations instead of patches?
pub const fn theme(mut self, output_theme: OutputTheme) -> Self { | ||
self.theme = output_theme; | ||
self | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like if I was looking for how to enable unicode support, I wouldn't be looking at theming.
@@ -1690,3 +1691,424 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | |||
let renderer = Renderer::plain(); | |||
assert_data_eq!(renderer.render(input_new), expected); | |||
} | |||
|
|||
#[test] | |||
fn e0271() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are these test names?
Can we add these tests without unicode support and then show how unicode support changes them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chore: Align more with rustc's output
"chore"s don't generally have user-visible impact. Isn't this a fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And in what way?
Cargo.toml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactor: Better match rustc's internal renderer
Since this has end-user impact, this isn't just about better matching the internals but the result and that should be reflected in the commit type
Ideally, the commit description would cover expected changes, including regressions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix: Use display and char pos in draw_line
That says what its doing; not what its fixing
No description provided.