diff --git a/docs/kcl-std/extrude.md b/docs/kcl-std/extrude.md index b782deb10..b8718834f 100644 --- a/docs/kcl-std/extrude.md +++ b/docs/kcl-std/extrude.md @@ -26,7 +26,7 @@ You can provide more than one sketch to extrude, and they will all be extruded i |----------|------|-------------|----------| | `sketches` | [`[Sketch]`](/docs/kcl-std/types/std-types-Sketch) | Which sketch or sketches should be extruded | Yes | | `length` | [`number`](/docs/kcl-std/types/std-types-number) | How far to extrude the given sketches | Yes | -| `symmetric` | [`bool`](/docs/kcl-std/types/std-types-bool) | If true, the extrusion will happen symmetrically around the sketch. Otherwise, the | No | +| `symmetric` | [`bool`](/docs/kcl-std/types/std-types-bool) | If true, the extrusion will happen symmetrically around the sketch. Otherwise, the extrusion will happen on only one side of the sketch. | No | | `bidirectionalLength` | [`number`](/docs/kcl-std/types/std-types-number) | If specified, will also extrude in the opposite direction to 'distance' to the specified distance. If 'symmetric' is true, this value is ignored. | No | | `tagStart` | [`TagDeclarator`](/docs/kcl-lang/types#TagDeclarator) | A named tag for the face at the start of the extrusion, i.e. the original sketch | No | | `tagEnd` | [`TagDeclarator`](/docs/kcl-lang/types#TagDeclarator) | A named tag for the face at the end of the extrusion, i.e. the new face created by extruding the original sketch | No | diff --git a/docs/kcl-std/std.json b/docs/kcl-std/std.json index 0f1a50455..2a31e7ffb 100644 --- a/docs/kcl-std/std.json +++ b/docs/kcl-std/std.json @@ -78747,7 +78747,7 @@ } }, "required": false, - "description": "If true, the extrusion will happen symmetrically around the sketch. Otherwise, the\n extrusion will happen on only one side of the sketch.", + "description": "If true, the extrusion will happen symmetrically around the sketch. Otherwise, the extrusion will happen on only one side of the sketch.", "labelRequired": true }, { diff --git a/rust/kcl-lib/src/docs/gen_std_tests.rs b/rust/kcl-lib/src/docs/gen_std_tests.rs index cb13415ed..7214ac7b5 100644 --- a/rust/kcl-lib/src/docs/gen_std_tests.rs +++ b/rust/kcl-lib/src/docs/gen_std_tests.rs @@ -380,6 +380,21 @@ fn generate_function_from_kcl( .enumerate() .filter_map(|(index, example)| generate_example(index, &example.0, &example.1, &example_name)) .collect(); + let args = function.args.iter().map(|arg| { + let docs = arg.docs.clone(); + if let Some(docs) = &docs { + // We deliberately truncate to one line in the template so that if we are using the docs + // from the type, then we only take the summary. However, if there's a newline in the + // arg docs, then they would get truncated unintentionally. + assert!(!docs.contains('\n'), "Arg docs will get truncated"); + }; + json!({ + "name": arg.name, + "type_": arg.ty, + "description": docs.or_else(|| arg.ty.as_ref().and_then(|t| super::docs_for_type(t, kcl_std))).unwrap_or_default(), + "required": arg.kind.required(), + }) + }).collect::>(); let data = json!({ "name": function.preferred_name, @@ -389,14 +404,7 @@ fn generate_function_from_kcl( "deprecated": function.properties.deprecated, "fn_signature": function.preferred_name.clone() + &function.fn_signature(), "examples": examples, - "args": function.args.iter().map(|arg| { - json!({ - "name": arg.name, - "type_": arg.ty, - "description": arg.docs.clone().or_else(|| arg.ty.as_ref().and_then(|t| super::docs_for_type(t, kcl_std))).unwrap_or_default(), - "required": arg.kind.required(), - }) - }).collect::>(), + "args": args, "return_value": function.return_type.as_ref().map(|t| { json!({ "type_": t, diff --git a/rust/kcl-lib/src/docs/mod.rs b/rust/kcl-lib/src/docs/mod.rs index 90c27d64b..4923b3095 100644 --- a/rust/kcl-lib/src/docs/mod.rs +++ b/rust/kcl-lib/src/docs/mod.rs @@ -167,6 +167,7 @@ impl StdLibFnArg { pub fn description(&self, kcl_std: Option<&ModData>) -> Option { // Check if we explicitly gave this stdlib arg a description. if !self.description.is_empty() { + assert!(!self.description.contains('\n'), "Arg docs will get truncated"); return Some(self.description.clone()); } diff --git a/rust/kcl-lib/src/std/extrude.rs b/rust/kcl-lib/src/std/extrude.rs index 6fca54c7c..a95ef2388 100644 --- a/rust/kcl-lib/src/std/extrude.rs +++ b/rust/kcl-lib/src/std/extrude.rs @@ -152,8 +152,7 @@ pub async fn extrude(exec_state: &mut ExecState, args: Args) -> Result