Skip to content

Commit

Permalink
Tweak formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchalmers committed Feb 14, 2025
1 parent 53805fe commit 7497641
Show file tree
Hide file tree
Showing 3 changed files with 3,311 additions and 4,963 deletions.
4 changes: 3 additions & 1 deletion src/wasm-lib/kcl/src/unparser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,9 @@ impl CallExpressionKw {
let name = &self.callee.name;
let arg_list = self.recast_args(options, indentation_level, ctxt);
let args = arg_list.clone().join(", ");
let multiline = arg_list.len() >= 4 || arg_list.iter().any(|arg| arg.contains('\n'));
let has_lots_of_args = arg_list.len() >= 4;
let some_arg_is_already_multiline = arg_list.len() > 1 && arg_list.iter().any(|arg| arg.contains('\n'));
let multiline = has_lots_of_args || some_arg_is_already_multiline;
if multiline {
let next_indent = indentation_level + 1;
let inner_indentation = if ctxt == ExprContext::Pipe {
Expand Down
30 changes: 12 additions & 18 deletions src/wasm-lib/kcl/tests/fillet-and-shell/input.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,18 @@ miniHdmiHole = startSketchAt([
0,
border + miniHdmiDistance - (miniHdmiWidth / 2)
])
|> line(
endAbsolute = [
0,
border + miniHdmiDistance + miniHdmiWidth / 2
],
)
|> line(
endAbsolute = [
1,
border + miniHdmiDistance + miniHdmiWidth / 2
],
)
|> line(
endAbsolute = [
1,
border + miniHdmiDistance - (miniHdmiWidth / 2)
],
)
|> line(endAbsolute = [
0,
border + miniHdmiDistance + miniHdmiWidth / 2
])
|> line(endAbsolute = [
1,
border + miniHdmiDistance + miniHdmiWidth / 2
])
|> line(endAbsolute = [
1,
border + miniHdmiDistance - (miniHdmiWidth / 2)
])
|> close(%)

case = startSketchOn('XY')
Expand Down
Loading

0 comments on commit 7497641

Please sign in to comment.