Skip to content

Commit 214b9bc

Browse files
authored
Use explicit units for angles in autocomplete (#8027)
Signed-off-by: Nick Cameron <[email protected]>
1 parent 7235ab4 commit 214b9bc

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

rust/kcl-lib/src/docs/kcl_doc.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,16 @@ impl ArgData {
814814
}
815815
match self.ty.as_deref() {
816816
Some("Sketch") if self.kind == ArgKind::Special => None,
817-
Some(s) if s.starts_with("number") => Some((index, format!(r#"{label}${{{index}:10}}"#))),
817+
Some(s) if s.starts_with("number") => {
818+
let value = match &*self.name {
819+
"angleStart" => "0",
820+
"angleEnd" => "180deg",
821+
"angle" => "180deg",
822+
"arcDegrees" => "360deg",
823+
_ => "10",
824+
};
825+
Some((index, format!(r#"{label}${{{index}:{value}}}"#)))
826+
}
818827
Some("Point2d") => Some((index + 1, format!(r#"{label}[${{{}:0}}, ${{{}:0}}]"#, index, index + 1))),
819828
Some("Point3d") => Some((
820829
index + 2,

rust/kcl-lib/src/docs/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ mod tests {
106106
let snippet = data.to_autocomplete_snippet();
107107
assert_eq!(
108108
snippet,
109-
r#"arc(angleStart = ${0:10}, angleEnd = ${1:10}, diameter = ${2:10})"#
109+
r#"arc(angleStart = ${0:0}, angleEnd = ${1:180deg}, diameter = ${2:10})"#
110110
);
111111
}
112112

@@ -172,7 +172,7 @@ mod tests {
172172
let snippet = helix_fn.to_autocomplete_snippet();
173173
assert_eq!(
174174
snippet,
175-
r#"helix(revolutions = ${0:10}, angleStart = ${1:10}, radius = ${2:10}, axis = ${3:X}, length = ${4:10})"#
175+
r#"helix(revolutions = ${0:10}, angleStart = ${1:0}, radius = ${2:10}, axis = ${3:X}, length = ${4:10})"#
176176
);
177177
}
178178

0 commit comments

Comments
 (0)