Change KCL completion to use new object/record syntax (#4815)
This commit is contained in:
@ -521,13 +521,13 @@ fn get_autocomplete_snippet_from_schema(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if prop_name == "color" {
|
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;
|
i += 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some((new_index, snippet)) = get_autocomplete_snippet_from_schema(prop, i)? {
|
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;
|
i = new_index + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -893,8 +893,8 @@ mod tests {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
snippet,
|
snippet,
|
||||||
r#"fillet({
|
r#"fillet({
|
||||||
radius: ${0:3.14},
|
radius = ${0:3.14},
|
||||||
tags: [${1:"tag_or_edge_fn"}],
|
tags = [${1:"tag_or_edge_fn"}],
|
||||||
}, ${2:%})${}"#
|
}, ${2:%})${}"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -914,11 +914,11 @@ mod tests {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
snippet,
|
snippet,
|
||||||
r#"patternCircular3d({
|
r#"patternCircular3d({
|
||||||
instances: ${0:10},
|
instances = ${0:10},
|
||||||
axis: [${1:3.14}, ${2:3.14}, ${3:3.14}],
|
axis = [${1:3.14}, ${2:3.14}, ${3:3.14}],
|
||||||
center: [${4:3.14}, ${5:3.14}, ${6:3.14}],
|
center = [${4:3.14}, ${5:3.14}, ${6:3.14}],
|
||||||
arcDegrees: ${7:3.14},
|
arcDegrees = ${7:3.14},
|
||||||
rotateDuplicates: ${8:false},
|
rotateDuplicates = ${8:false},
|
||||||
}, ${9:%})${}"#
|
}, ${9:%})${}"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -930,7 +930,7 @@ mod tests {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
snippet,
|
snippet,
|
||||||
r#"revolve({
|
r#"revolve({
|
||||||
axis: ${0:"X"},
|
axis = ${0:"X"},
|
||||||
}, ${1:%})${}"#
|
}, ${1:%})${}"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -942,8 +942,8 @@ mod tests {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
snippet,
|
snippet,
|
||||||
r#"circle({
|
r#"circle({
|
||||||
center: [${0:3.14}, ${1:3.14}],
|
center = [${0:3.14}, ${1:3.14}],
|
||||||
radius: ${2:3.14},
|
radius = ${2:3.14},
|
||||||
}, ${3:%})${}"#
|
}, ${3:%})${}"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -955,9 +955,9 @@ mod tests {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
snippet,
|
snippet,
|
||||||
r#"arc({
|
r#"arc({
|
||||||
angleStart: ${0:3.14},
|
angleStart = ${0:3.14},
|
||||||
angleEnd: ${1:3.14},
|
angleEnd = ${1:3.14},
|
||||||
radius: ${2:3.14},
|
radius = ${2:3.14},
|
||||||
}, ${3:%})${}"#
|
}, ${3:%})${}"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -976,9 +976,9 @@ mod tests {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
snippet,
|
snippet,
|
||||||
r#"patternLinear2d({
|
r#"patternLinear2d({
|
||||||
instances: ${0:10},
|
instances = ${0:10},
|
||||||
distance: ${1:3.14},
|
distance = ${1:3.14},
|
||||||
axis: [${2:3.14}, ${3:3.14}],
|
axis = [${2:3.14}, ${3:3.14}],
|
||||||
}, ${4:%})${}"#
|
}, ${4:%})${}"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -990,7 +990,7 @@ mod tests {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
snippet,
|
snippet,
|
||||||
r#"appearance({
|
r#"appearance({
|
||||||
color: ${0:"#
|
color = ${0:"#
|
||||||
.to_owned()
|
.to_owned()
|
||||||
+ "\"#"
|
+ "\"#"
|
||||||
+ r#"ff0000"},
|
+ r#"ff0000"},
|
||||||
@ -1012,7 +1012,7 @@ mod tests {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
snippet,
|
snippet,
|
||||||
r#"sweep({
|
r#"sweep({
|
||||||
path: ${0:sketch000},
|
path = ${0:sketch000},
|
||||||
}, ${1:%})${}"#
|
}, ${1:%})${}"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user