-
Notifications
You must be signed in to change notification settings - Fork 90
[fm] handle multi-line comment fields in FM displayers
#10710
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
Changes from all commits
87cc945
36a35c8
7de685d
f95c261
5e058e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| multi-line comment: | ||
| // this comment | ||
| // spans multiple lines | ||
| // isn't that cool? | ||
| * flat_key: flat_value |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,8 +115,8 @@ impl Metadata { | |
| const CLOSED_IN: &str = "closed in sitrep:"; | ||
| const WIDTH: usize = const_max_len(&[DE, OPENED_IN, CLOSED_IN]); | ||
|
|
||
| if !comment.is_empty() { | ||
| writeln!(f, "{:>indent$}// {comment}", "")?; | ||
| for line in comment.lines() { | ||
| writeln!(f, "{:>indent$}// {line}", "")?; | ||
| } | ||
| writeln!(f, "{:>indent$}{DE:<WIDTH$} {de}", "")?; | ||
| writeln!( | ||
|
|
@@ -233,8 +233,8 @@ impl Fact { | |
| }; | ||
|
|
||
| writeln!(f, "{BULLET:>indent$}fact {id}")?; | ||
| if !comment.is_empty() { | ||
| writeln!(f, "{:>indent$}// {comment}", "")?; | ||
| for line in comment.lines() { | ||
| writeln!(f, "{:>indent$}// {line}", "")?; | ||
| } | ||
| writeln!( | ||
| f, | ||
|
|
@@ -346,20 +346,21 @@ impl fmt::Display for DisplayCase<'_> { | |
| const REPORTED_BY: &str = "reported by:"; | ||
| const ADDED_IN: &str = "added in:"; | ||
| const ASSIGNMENT_ID: &str = "assignment ID:"; | ||
| const COMMENT: &str = "comment:"; | ||
|
|
||
| const WIDTH: usize = const_max_len(&[ | ||
| CLASS, | ||
| REPORTED_BY, | ||
| ADDED_IN, | ||
| ASSIGNMENT_ID, | ||
| COMMENT, | ||
| ]); | ||
|
|
||
| let pn = ereport.part_number.as_deref().unwrap_or("<UNKNOWN>"); | ||
| let sn = | ||
| ereport.serial_number.as_deref().unwrap_or("<UNKNOWN>"); | ||
| writeln!(f, "{BULLET:>indent$}ereport {}", ereport.id)?; | ||
| for line in comment.lines() { | ||
| writeln!(f, "{:>indent$}// {line}", "")?; | ||
| } | ||
|
Comment on lines
360
to
+363
Comment on lines
360
to
+363
|
||
| writeln!( | ||
| f, | ||
| "{:>indent$}{CLASS:<WIDTH$} {}", | ||
|
|
@@ -378,7 +379,7 @@ impl fmt::Display for DisplayCase<'_> { | |
| this_sitrep(*assigned_sitrep_id) | ||
| )?; | ||
| writeln!(f, "{:>indent$}{ASSIGNMENT_ID:<WIDTH$} {id}", "")?; | ||
| writeln!(f, "{:>indent$}{COMMENT:<WIDTH$} {comment}\n", "",)?; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... I think copilot was also saying something to this effect, but do we want to add a We took out the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. they have bullet points, so i removed the newline since i felt like it was wasting vertical space. i can put it back if you feel strongly about it?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, nah, I didn't realize there was "some separator". Don't care that much |
||
| writeln!(f)?; | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -408,12 +409,13 @@ impl fmt::Display for DisplayCase<'_> { | |
| { | ||
| const CLASS: &str = "class:"; | ||
| const REQUESTED_IN: &str = "requested in:"; | ||
| const COMMENT: &str = "comment:"; | ||
|
|
||
| const WIDTH: usize = | ||
| const_max_len(&[CLASS, REQUESTED_IN, COMMENT]); | ||
| const WIDTH: usize = const_max_len(&[CLASS, REQUESTED_IN]); | ||
|
|
||
| writeln!(f, "{BULLET:>indent$}alert {id}",)?; | ||
| for line in comment.lines() { | ||
| writeln!(f, "{:>indent$}// {line}", "")?; | ||
| } | ||
|
Comment on lines
415
to
+418
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks i changed this on purpose |
||
| writeln!( | ||
| f, | ||
| "{:>indent$}{CLASS:<WIDTH$} {class}, v{version}", | ||
|
|
@@ -425,7 +427,7 @@ impl fmt::Display for DisplayCase<'_> { | |
| "", | ||
| this_sitrep(*requested_sitrep_id) | ||
| )?; | ||
| writeln!(f, "{:>indent$}{COMMENT:<WIDTH$} {comment}\n", "")?; | ||
| writeln!(f)?; | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -443,11 +445,13 @@ impl fmt::Display for DisplayCase<'_> { | |
| { | ||
| const REQUESTED_IN: &str = "requested in:"; | ||
| const DATA: &str = "data:"; | ||
| const COMMENT: &str = "comment:"; | ||
| const WIDTH: usize = | ||
| const_max_len(&[REQUESTED_IN, DATA, COMMENT]); | ||
| const WIDTH: usize = const_max_len(&[REQUESTED_IN, DATA]); | ||
|
|
||
| writeln!(f, "{BULLET:>indent$}bundle {id}",)?; | ||
|
|
||
| for line in comment.lines() { | ||
| writeln!(f, "{:>indent$}// {line}", "")?; | ||
| } | ||
|
Comment on lines
450
to
+454
|
||
| writeln!( | ||
| f, | ||
| "{:>indent$}{REQUESTED_IN:<WIDTH$} {requested_sitrep_id}{}", | ||
|
|
@@ -456,7 +460,7 @@ impl fmt::Display for DisplayCase<'_> { | |
| )?; | ||
| writeln!(f, "{:>indent$}{DATA}", "")?; | ||
| writeln!(f, "{}", data_selection.display(indent + 2))?; | ||
| writeln!(f, "{:>indent$}{COMMENT:<WIDTH$} {comment}\n", "")?; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think copilot is weird with where it's choosing to insert commentary , but the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, i will return the newlines |
||
| writeln!(f)?; | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
Thanks for pulling this into a new PR; appreciate it being decoupled