Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Emit doc strings for custom value setters
Marshall Bowersf09df314801d
diff --git a/crates/gpui3_macros/src/style_helpers.rs b/crates/gpui3_macros/src/style_helpers.rsindex a2541791904..8090112077b 100644--- a/crates/gpui3_macros/src/style_helpers.rs+++ b/crates/gpui3_macros/src/style_helpers.rs@@ -36,6 +36,7 @@ fn generate_methods() -> Vec<TokenStream2> {quote! { DefiniteLength }},&fields,+ prefix_doc_string,));for (suffix, length_tokens, suffix_doc_string) in box_suffixes() {@@ -68,6 +69,7 @@ fn generate_methods() -> Vec<TokenStream2> {prefix,quote! { AbsoluteLength },&fields,+ "todo!(docstring)",));for (suffix, radius_tokens, doc_string) in corner_suffixes() {@@ -142,6 +144,7 @@ fn generate_custom_value_setter(prefix: &'static str,length_type: TokenStream2,fields: &Vec<TokenStream2>,+ doc_string: &str,) -> TokenStream2 {let method_name = format_ident!("{}", prefix);@@ -159,6 +162,7 @@ fn generate_custom_value_setter(.collect::<Vec<_>>();let method = quote! {+ #[doc = #doc_string]fn #method_name(mut self, length: impl std::clone::Clone + Into<gpui3::#length_type>) -> Self where Self: std::marker::Sized {let mut style = self.declared_style();#(#field_assignments)*@@ -171,7 +175,12 @@ fn generate_custom_value_setter(fn box_prefixes() -> Vec<(&'static str, bool, Vec<TokenStream2>, &'static str)> {vec![- ("w", true, vec![quote! { size.width }], "todo!(docstring)"),+ (+ "w",+ true,+ vec![quote! { size.width }],+ "Sets the width of the element. [Docs](https://tailwindcss.com/docs/width)",+ ),("h", true, vec![quote! { size.height }], "todo!(docstring)"),("size",diff --git a/crates/ui2/src/elements/label.rs b/crates/ui2/src/elements/label.rsindex 46edeeadbee..0ac93d436a7 100644--- a/crates/ui2/src/elements/label.rs+++ b/crates/ui2/src/elements/label.rs@@ -185,7 +185,11 @@ mod stories {}}- fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {+ fn render(+ &mut self,+ _view: &mut S,+ cx: &mut ViewContext<S>,+ ) -> impl Element<ViewState = S> {Story::container(cx).child(Story::title_for::<_, Label<S>>(cx)).child(Story::label(cx, "Default"))