Move edge functions to KCL (#7259)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
@ -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" {
|
||||
|
@ -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]
|
||||
|
Reference in New Issue
Block a user