Change KCL completion to use new object/record syntax (#4815)

This commit is contained in:
Jonathan Tran
2024-12-16 13:29:50 -05:00
committed by GitHub
parent da301ba862
commit 1d39983b08

View File

@ -521,13 +521,13 @@ fn get_autocomplete_snippet_from_schema(
}
if prop_name == "color" {
fn_docs.push_str(&format!("\t{}: ${{{}:\"#ff0000\"}},\n", prop_name, i));
fn_docs.push_str(&format!("\t{} = ${{{}:\"#ff0000\"}},\n", prop_name, i));
i += 1;
continue;
}
if let Some((new_index, snippet)) = get_autocomplete_snippet_from_schema(prop, i)? {
fn_docs.push_str(&format!("\t{}: {},\n", prop_name, snippet));
fn_docs.push_str(&format!("\t{} = {},\n", prop_name, snippet));
i = new_index + 1;
}
}
@ -893,8 +893,8 @@ mod tests {
assert_eq!(
snippet,
r#"fillet({
radius: ${0:3.14},
tags: [${1:"tag_or_edge_fn"}],
radius = ${0:3.14},
tags = [${1:"tag_or_edge_fn"}],
}, ${2:%})${}"#
);
}
@ -914,11 +914,11 @@ mod tests {
assert_eq!(
snippet,
r#"patternCircular3d({
instances: ${0:10},
axis: [${1:3.14}, ${2:3.14}, ${3:3.14}],
center: [${4:3.14}, ${5:3.14}, ${6:3.14}],
arcDegrees: ${7:3.14},
rotateDuplicates: ${8:false},
instances = ${0:10},
axis = [${1:3.14}, ${2:3.14}, ${3:3.14}],
center = [${4:3.14}, ${5:3.14}, ${6:3.14}],
arcDegrees = ${7:3.14},
rotateDuplicates = ${8:false},
}, ${9:%})${}"#
);
}
@ -930,7 +930,7 @@ mod tests {
assert_eq!(
snippet,
r#"revolve({
axis: ${0:"X"},
axis = ${0:"X"},
}, ${1:%})${}"#
);
}
@ -942,8 +942,8 @@ mod tests {
assert_eq!(
snippet,
r#"circle({
center: [${0:3.14}, ${1:3.14}],
radius: ${2:3.14},
center = [${0:3.14}, ${1:3.14}],
radius = ${2:3.14},
}, ${3:%})${}"#
);
}
@ -955,9 +955,9 @@ mod tests {
assert_eq!(
snippet,
r#"arc({
angleStart: ${0:3.14},
angleEnd: ${1:3.14},
radius: ${2:3.14},
angleStart = ${0:3.14},
angleEnd = ${1:3.14},
radius = ${2:3.14},
}, ${3:%})${}"#
);
}
@ -976,9 +976,9 @@ mod tests {
assert_eq!(
snippet,
r#"patternLinear2d({
instances: ${0:10},
distance: ${1:3.14},
axis: [${2:3.14}, ${3:3.14}],
instances = ${0:10},
distance = ${1:3.14},
axis = [${2:3.14}, ${3:3.14}],
}, ${4:%})${}"#
);
}
@ -990,7 +990,7 @@ mod tests {
assert_eq!(
snippet,
r#"appearance({
color: ${0:"#
color = ${0:"#
.to_owned()
+ "\"#"
+ r#"ff0000"},
@ -1012,7 +1012,7 @@ mod tests {
assert_eq!(
snippet,
r#"sweep({
path: ${0:sketch000},
path = ${0:sketch000},
}, ${1:%})${}"#
);
}