From a798bd81c65e16df51f9fb9b4f1eb714bb5f187c Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Fri, 18 Oct 2024 14:30:24 +0800 Subject: [PATCH] chore: Fix typos. (#364) --- .github/workflows/ci.yml | 6 ++++- README.md | 2 +- crates/story/src/fixtures/pie.json | 36 ++++++++--------------------- crates/story/src/switch_story.rs | 6 ++--- crates/ui/src/colors.rs | 4 ++-- crates/ui/src/dock/invalid_panel.rs | 2 +- crates/ui/src/dock/panel.rs | 2 +- crates/ui/src/dock/tab_panel.rs | 2 +- crates/ui/src/list/list.rs | 4 ++-- crates/ui/src/popup_menu.rs | 2 +- crates/ui/src/resizable/panel.rs | 22 ++++++++---------- crates/ui/src/root.rs | 2 +- 12 files changed, 38 insertions(+), 52 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ee7f53f..228012de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,11 @@ jobs: ~/.cargo/git/db/ target/ key: ubuntu-test-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Install Tools + run: cargo install typos-cli - name: Lint - run: cargo clippy -- --deny warnings + run: | + cargo clippy -- --deny warnings + typos - name: Build test run: cargo build diff --git a/README.md b/README.md index 85f57cca..f7b1daf7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# GPUI Compoment +# GPUI Component > This is still an early stage of development, we may change API frequently. > But the features is ok to use, you must keep tracking our changes. diff --git a/crates/story/src/fixtures/pie.json b/crates/story/src/fixtures/pie.json index 5bb47833..2dd8c190 100644 --- a/crates/story/src/fixtures/pie.json +++ b/crates/story/src/fixtures/pie.json @@ -2,7 +2,7 @@ "border_radius": 2, "width": 400, "height": 300, - "inner_radus": 30, + "inner_radius": 30, "legend_margin": { "top": 0 }, @@ -12,55 +12,39 @@ "series_list": [ { "name": "rose 1", - "data": [ - 40 - ] + "data": [40] }, { "name": "rose 2", - "data": [ - 38 - ] + "data": [38] }, { "name": "rose 3", - "data": [ - 32 - ] + "data": [32] }, { "name": "rose 4", - "data": [ - 30 - ] + "data": [30] }, { "name": "rose 5", - "data": [ - 28 - ] + "data": [28] }, { "name": "rose 6", - "data": [ - 26 - ] + "data": [26] }, { "name": "rose 7", - "data": [ - 22 - ] + "data": [22] }, { "name": "rose 8", - "data": [ - 18 - ] + "data": [18] } ], "sub_title_text": "Sub Title", "theme": "light", "title_text": "Nightingale Chart", "type": "pie" -} \ No newline at end of file +} diff --git a/crates/story/src/switch_story.rs b/crates/story/src/switch_story.rs index 34546c6c..0eeb5234 100644 --- a/crates/story/src/switch_story.rs +++ b/crates/story/src/switch_story.rs @@ -102,7 +102,7 @@ impl Render for SwitchStory { card(cx) .child( title("Security emails").child( - Label::new("Receive emails about your account security. When turn off, you never recive email again.").text_color(theme.muted_foreground) + Label::new("Receive emails about your account security. When turn off, you never receive email again.").text_color(theme.muted_foreground) ) ) .child( @@ -116,7 +116,7 @@ impl Render for SwitchStory { ) .child( card(cx).v_flex() - .items_start().child(title("Disabled Switchs")).child( + .items_start().child(title("Disabled Switches")).child( h_flex().items_center() .gap_6() .child(Switch::new("switch3").disabled(true).on_click(|v, _| { @@ -133,7 +133,7 @@ impl Render for SwitchStory { ) .child( card(cx).v_flex() - .items_start().child(title("Small Switchs")).child( + .items_start().child(title("Small Switches")).child( h_flex().items_center() .gap_6() .child(Switch::new("switch3").checked(self.switch3).label("Small Size").small().on_click(cx.listener(move |view, checked, cx| { diff --git a/crates/ui/src/colors.rs b/crates/ui/src/colors.rs index 3d1c0d5c..e4c1488e 100644 --- a/crates/ui/src/colors.rs +++ b/crates/ui/src/colors.rs @@ -136,12 +136,12 @@ pub(crate) struct ShadcnColors { pub(crate) struct ShadcnColor { #[serde(default)] pub(crate) scale: usize, - #[serde(deserialize_with = "from_hsa_channel", alias = "hslChannel")] + #[serde(deserialize_with = "from_hsl_channel", alias = "hslChannel")] pub(crate) hsla: Hsla, } /// Deserialize Hsla from a string in the format "210 40% 98%" -fn from_hsa_channel<'de, D>(deserializer: D) -> Result +fn from_hsl_channel<'de, D>(deserializer: D) -> Result where D: Deserializer<'de>, { diff --git a/crates/ui/src/dock/invalid_panel.rs b/crates/ui/src/dock/invalid_panel.rs index 2c922a2c..a89ebbee 100644 --- a/crates/ui/src/dock/invalid_panel.rs +++ b/crates/ui/src/dock/invalid_panel.rs @@ -50,7 +50,7 @@ impl Render for InvalidPanel { .justify_center() .text_color(cx.theme().muted_foreground) .child(format!( - "The `{}` panel type is not registed in PanelRegistry.", + "The `{}` panel type is not registered in PanelRegistry.", self.name.clone() )) } diff --git a/crates/ui/src/dock/panel.rs b/crates/ui/src/dock/panel.rs index 73a2e12c..b8c2106d 100644 --- a/crates/ui/src/dock/panel.rs +++ b/crates/ui/src/dock/panel.rs @@ -48,7 +48,7 @@ pub trait Panel: EventEmitter + FocusableView { true } - /// Return true if the panel is collapsable, default is `false`. + /// Return true if the panel is collapsible, default is `false`. fn collapsible(&self, _cx: &WindowContext) -> bool { false } diff --git a/crates/ui/src/dock/tab_panel.rs b/crates/ui/src/dock/tab_panel.rs index 0906d200..b037b674 100644 --- a/crates/ui/src/dock/tab_panel.rs +++ b/crates/ui/src/dock/tab_panel.rs @@ -706,7 +706,7 @@ impl TabPanel { } } - // Here is looks like remove_panel on a same item, but it differnece. + // Here is looks like remove_panel on a same item, but it difference. // // We must to split it to remove_panel, unless it will be crash by error: // Cannot update ui::dock::tab_panel::TabPanel while it is already being updated diff --git a/crates/ui/src/list/list.rs b/crates/ui/src/list/list.rs index 79dd0726..586daa00 100644 --- a/crates/ui/src/list/list.rs +++ b/crates/ui/src/list/list.rs @@ -386,7 +386,7 @@ where ListSizingBehavior::Auto }; - let inital_view = if let Some(input) = &self.query_input { + let initial_view = if let Some(input) = &self.query_input { if input.read(cx).text().is_empty() { self.delegate().render_initial(cx) } else { @@ -420,7 +420,7 @@ where ) }) .map(|this| { - if let Some(view) = inital_view { + if let Some(view) = initial_view { this.child(view) } else { this.child( diff --git a/crates/ui/src/popup_menu.rs b/crates/ui/src/popup_menu.rs index cf378440..540af06b 100644 --- a/crates/ui/src/popup_menu.rs +++ b/crates/ui/src/popup_menu.rs @@ -130,7 +130,7 @@ impl PopupMenu { }) } - /// Bind the focus handle of the menu, when clicked, it will focus back to this handle and then dispath the action + /// Bind the focus handle of the menu, when clicked, it will focus back to this handle and then dispatch the action pub fn track_focus(mut self, focus_handle: &FocusHandle) -> Self { self.action_focus_handle = Some(focus_handle.clone()); self diff --git a/crates/ui/src/resizable/panel.rs b/crates/ui/src/resizable/panel.rs index dfb29a16..9d8cdcc2 100644 --- a/crates/ui/src/resizable/panel.rs +++ b/crates/ui/src/resizable/panel.rs @@ -278,7 +278,7 @@ pub struct ResizablePanel { group: Option>, /// Initial size is the size that the panel has when it is created. initial_size: Option, - /// size is the size that the panel has when it is resized or ajusted by flex layout. + /// size is the size that the panel has when it is resized or adjusted by flex layout. size: Option, /// the size ratio that the panel has relative to its group size_ratio: Option, @@ -352,7 +352,7 @@ impl Render for ResizablePanel { fn render(&mut self, cx: &mut ViewContext) -> impl IntoElement { let view = cx.view().clone(); let total_size = self.group.as_ref().map(|group| group.read(cx).total_size()); - + div() .flex() .flex_grow() @@ -367,16 +367,14 @@ impl Render for ResizablePanel { this.when(self.size.is_none(), |this| this.flex_shrink_0()) .flex_basis(size) }) - .map( - |this| match (self.size_ratio, self.size, total_size) { - (Some(size_ratio), _, _) => this.flex_basis(relative(size_ratio)), - (None, Some(size), Some(total_size)) => { - this.flex_basis(relative(size / total_size)) - } - (None, Some(size), None) => this.flex_basis(size), - _ => this, - }, - ) + .map(|this| match (self.size_ratio, self.size, total_size) { + (Some(size_ratio), _, _) => this.flex_basis(relative(size_ratio)), + (None, Some(size), Some(total_size)) => { + this.flex_basis(relative(size / total_size)) + } + (None, Some(size), None) => this.flex_basis(size), + _ => this, + }) .child({ canvas( move |bounds, cx| view.update(cx, |r, cx| r.update_size(bounds, cx)), diff --git a/crates/ui/src/root.rs b/crates/ui/src/root.rs index 05fa2722..3360f679 100644 --- a/crates/ui/src/root.rs +++ b/crates/ui/src/root.rs @@ -202,7 +202,7 @@ impl<'a, V> ContextModal for ViewContext<'a, V> { /// /// It is used to manage the Drawer, Modal, and Notification. pub struct Root { - /// Used to store the focus handle of the previus revious view. + /// Used to store the focus handle of the previous view. /// When the Modal, Drawer closes, we will focus back to the previous view. previous_focus_handle: Option, active_drawer: Option,