Move edge functions to KCL (#7259)

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-05-29 10:14:04 +12:00
committed by GitHub
parent 5c6d4fbf5a
commit 2ac05508bc
18 changed files with 273 additions and 423 deletions

View File

@ -827,6 +827,10 @@ impl ArgData {
Some("Edge") => Some((index, format!(r#"{label}${{{index}:tag_or_edge_fn}}"#))),
Some("[Edge; 1+]") => Some((index, format!(r#"{label}[${{{index}:tag_or_edge_fn}}]"#))),
Some("Plane") => Some((index, format!(r#"{label}${{{}:XY}}"#, index))),
Some("[tag; 2]") => Some((
index + 1,
format!(r#"{label}[${{{}:tag}}, ${{{}:tag}}]"#, index, index + 1),
)),
Some("string") => {
if self.name == "color" {

View File

@ -1148,14 +1148,12 @@ mod tests {
#[test]
fn get_autocomplete_snippet_get_common_edge() {
let get_common_edge_fn: Box<dyn StdLibFn> = Box::new(crate::std::edge::GetCommonEdge);
let snippet = get_common_edge_fn.to_autocomplete_snippet().unwrap();
assert_eq!(
snippet,
r#"getCommonEdge(faces = [{
value = ${0:"string"},
}])"#
);
let data = kcl_doc::walk_prelude();
let DocData::Fn(data) = data.find_by_name("getCommonEdge").unwrap() else {
panic!();
};
let snippet = data.to_autocomplete_snippet();
assert_eq!(snippet, r#"getCommonEdge(faces = [${0:tag}, ${1:tag}])"#);
}
#[test]