-
Notifications
You must be signed in to change notification settings - Fork 321
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
Documentation panel redesign #7372
Conversation
/// No documentation is available for the entry. | ||
#[derive(Debug, Clone, CloneRef, PartialEq)] | ||
#[derive(Debug, Clone, Copy, CloneRef, PartialEq)] | ||
#[allow(missing_docs)] | ||
pub enum Placeholder { | ||
/// Documentation is empty. | ||
NoDocumentation, | ||
/// Documentation for the Virtual Component group. | ||
VirtualComponentGroup { name: ImString }, | ||
} |
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 guess we could make it a structure? Or it's not needed anymore?
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.
It's not needed anymore and I removed it.
self.breadcrumbs.set_xy(Vector2(0.0, size.y + 36.0)); | ||
self.breadcrumbs.frp().set_size(Vector2(size.x, 32.0)); | ||
} | ||
|
||
/// Display the documentation and scroll to the qualified name if needed. |
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.
This comment seems outdated (already before this change)
let size = Vector2(style.width * width_factor, style.height); | ||
self.overlay.set_size(size); | ||
let dom_size = Vector2(size.x, size.y - style.breadcrumbs_height); | ||
self.dom.set_dom_size(dom_size); | ||
self.dom.set_xy(dom_size / 2.0); | ||
|
||
self.background.set_color(style.background); | ||
self.background.set_corner_radius(style.corner_radius); | ||
self.background.set_size(size); | ||
|
||
self.overlay.set_corner_radius(style.corner_radius); | ||
self.outer_dom.set_style_or_warn("border-radius", format!("{}px", style.corner_radius)); | ||
self.inner_dom.set_style_or_warn("border-radius", format!("{}px", style.corner_radius)); | ||
let bg_color = style.background.to_javascript_string(); | ||
self.outer_dom.set_style_or_warn("background-color", bg_color); | ||
self.dom.set_style_or_warn("border-radius", format!("{}px", style.corner_radius)); | ||
|
||
self.breadcrumbs.set_xy(Vector2(0.0, size.y)); | ||
self.breadcrumbs.frp().set_size(Vector2(size.x, style.breadcrumbs_height)); |
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 don't understand how these lines are organized--it is partially by the component, but some of the corner_radius
configuration has its own section?
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've moved them to be organised by component.
@@ -155,6 +186,9 @@ impl<L> TokenConsumer<L> for DocSectionCollector { | |||
fn enter_keyed_section(&mut self, header: Span<'_, L>) { | |||
self.finish_section(); | |||
let key = header.to_string(); | |||
if key.to_lowercase() == "arguments" { |
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 key.to_lowercase() == "arguments" { | |
if key.eq_ignore_ascii_case("Arguments") { |
We process a lot of documentation; it's important to avoid allocations when we can.
Some(DocSection::Tag { .. }) | ||
| Some(DocSection::List { .. }) | ||
| Some(DocSection::Arguments { .. }) | ||
| None => self.sections.push(DocSection::Paragraph { body: text }), |
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.
This is causing the empty Paragraph
between the List
and the "Example:" section in the new test. The empty paragraph is not needed; the newlines between sections are implicit.
Some(DocSection::Tag { .. }) | |
| Some(DocSection::List { .. }) | |
| Some(DocSection::Arguments { .. }) | |
| None => self.sections.push(DocSection::Paragraph { body: text }), | |
Some(DocSection::List { .. }) | Some(DocSection::Arguments { .. }) => (), | |
Some(DocSection::Tag { .. }) | None => self.sections.push(DocSection::Paragraph { body: text }), |
ScopeType::List => self.current_body.push_str("</ul>"), | ||
ScopeType::ListItem => (), | ||
ScopeType::List => { | ||
let items = mem::take(&mut self.current_list); |
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.
This gives away our buffer. If we take
it, we need log(size)
allocations per list. If we iterate/clone it and then clear
it, we only need one allocation per List
.
} | ||
} | ||
ScopeType::ListItem => { | ||
self.current_list.push(mem::take(&mut self.current_body)); |
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.
self.current_list.push(mem::take(&mut self.current_body)); | |
self.current_list.push(self.current_body.drain(..).collect()); |
}].to_vec() | ||
}, | ||
List { items: ["List item 1".into(), "List item 2".into(), "List item 3".into()].to_vec() }, | ||
Paragraph { body: "".into() }, |
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.
Spurious, see above.
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.
it's the same (automatic) package-lock.json
change as in some other PRs.
when merging with develop, this change should go away, because said change has been merged into develop
:
enso/app/ide-desktop/package-lock.json
Line 447 in 73237b7
"enso-chat": "git://github.com/enso-org/enso-bot", |
4c2beed
to
6658bb8
Compare
Added padding_x and padding_y to hardcoded theme's breadcrumb settings to ensure consistent padding. Also, these padding settings and breadcrumb_height are now used directly in the Style structure, eliminating hardcoded values in the view documentation.
I'll take it from here, thanks for testing. |
@Frizi I fixed both issues.
Could you retest? |
@Frizi can you retest it? |
QA Status: 🟡The above issues has been fixed, but i've noticed that invalid behavior of the documentation show/hide action has been reintroduced. The content of the panel should not be reflowed on every frame of the animation. Instead, it should be clipped to fit the animated background size, without acutally changing the content width of underlying DOM element. See point 2. in #7350 (comment) No other issues spotted, so once show/hide is fixed it's good to go. |
Pull Request Description
Based on #7350
Closes #7356
Arguments:
keyword. Each item in the list is split into argument names and descriptions, and we use this information to highlight argument names in the documentation.I'm not confident with my changes to the doc parser, especially due to the fact there were exactly zero tests for it.
4px
instead of0.25rem
to simplify matching with the design. I believe it is the way as we want the most accurate translation from Figma, even though it is generally not the best practice....
button...) will require more effort.code
tags in the documentation. Now text emphasized with backticks has a separate background color.2023-07-23.17-34-13.mp4
Important Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.