Emit doc strings for custom value setters
This commit is contained in:
@@ -36,6 +36,7 @@ fn generate_methods() -> Vec<TokenStream2> {
|
|||||||
quote! { DefiniteLength }
|
quote! { DefiniteLength }
|
||||||
},
|
},
|
||||||
&fields,
|
&fields,
|
||||||
|
prefix_doc_string,
|
||||||
));
|
));
|
||||||
|
|
||||||
for (suffix, length_tokens, suffix_doc_string) in box_suffixes() {
|
for (suffix, length_tokens, suffix_doc_string) in box_suffixes() {
|
||||||
@@ -68,6 +69,7 @@ fn generate_methods() -> Vec<TokenStream2> {
|
|||||||
prefix,
|
prefix,
|
||||||
quote! { AbsoluteLength },
|
quote! { AbsoluteLength },
|
||||||
&fields,
|
&fields,
|
||||||
|
"todo!(docstring)",
|
||||||
));
|
));
|
||||||
|
|
||||||
for (suffix, radius_tokens, doc_string) in corner_suffixes() {
|
for (suffix, radius_tokens, doc_string) in corner_suffixes() {
|
||||||
@@ -142,6 +144,7 @@ fn generate_custom_value_setter(
|
|||||||
prefix: &'static str,
|
prefix: &'static str,
|
||||||
length_type: TokenStream2,
|
length_type: TokenStream2,
|
||||||
fields: &Vec<TokenStream2>,
|
fields: &Vec<TokenStream2>,
|
||||||
|
doc_string: &str,
|
||||||
) -> TokenStream2 {
|
) -> TokenStream2 {
|
||||||
let method_name = format_ident!("{}", prefix);
|
let method_name = format_ident!("{}", prefix);
|
||||||
|
|
||||||
@@ -159,6 +162,7 @@ fn generate_custom_value_setter(
|
|||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
let method = quote! {
|
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 {
|
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();
|
let mut style = self.declared_style();
|
||||||
#(#field_assignments)*
|
#(#field_assignments)*
|
||||||
@@ -171,7 +175,12 @@ fn generate_custom_value_setter(
|
|||||||
|
|
||||||
fn box_prefixes() -> Vec<(&'static str, bool, Vec<TokenStream2>, &'static str)> {
|
fn box_prefixes() -> Vec<(&'static str, bool, Vec<TokenStream2>, &'static str)> {
|
||||||
vec![
|
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)"),
|
("h", true, vec![quote! { size.height }], "todo!(docstring)"),
|
||||||
(
|
(
|
||||||
"size",
|
"size",
|
||||||
|
|||||||
@@ -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)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, Label<S>>(cx))
|
.child(Story::title_for::<_, Label<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|||||||
Reference in New Issue
Block a user