Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/src/cli_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3523,7 +3523,7 @@ impl LogContentFormat {
if self.word_wrap {
let mut recorder = FormatRecorder::new(formatter.maybe_color());
content_fn(&mut recorder).await?;
text_util::write_wrapped(formatter, &recorder, self.width)?;
text_util::write_wrapped(formatter, &recorder, self.width, false)?;
} else {
content_fn(formatter).await?;
}
Expand Down
22 changes: 16 additions & 6 deletions cli/src/template_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2387,14 +2387,24 @@ fn builtin_functions<'a, L: TemplateLanguage<'a> + ?Sized>() -> TemplateBuildFun
// code completion inside macro is quite restricted.
let mut map = TemplateBuildFunctionFnMap::<L>::new();
map.insert("fill", |language, diagnostics, build_ctx, function| {
let [width_node, content_node] = function.expect_exact_arguments()?;
let ([width_node, content_node], [break_words_node]) =
function.expect_named_arguments(&["", "", "break_words"])?;
let width = expect_usize_expression(language, diagnostics, build_ctx, width_node)?;
let content = expect_template_expression(language, diagnostics, build_ctx, content_node)?;
let template =
ReformatTemplate::new(content, move |formatter, recorded| match width.extract() {
Ok(width) => text_util::write_wrapped(formatter.as_mut(), recorded, width),
Err(err) => formatter.handle_error(err),
});
let break_words = break_words_node
.map(|node| expect_boolean_expression(language, diagnostics, build_ctx, node))
.transpose()?;
let template = ReformatTemplate::new(content, move |formatter, recorded| {
match (width.extract(), break_words.extract()) {
(Ok(width), Ok(break_words)) => text_util::write_wrapped(
formatter.as_mut(),
recorded,
width,
break_words.unwrap_or(false),
),
(Err(err), _) | (_, Err(err)) => formatter.handle_error(err),
}
});
Ok(L::Property::wrap_template(Box::new(template)))
});
map.insert("indent", |language, diagnostics, build_ctx, function| {
Expand Down
Loading
Loading