Skip to content

Commit 5f27f54

Browse files
authored
Fix syntax highlighting in formatting and rendering (#84)
Fix a regression in formatting and rendering of code blocks and bindings introduced when we improved error messages in #81.
2 parents c699d00 + cacee3b commit 5f27f54

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

src/formatting/formatter.rs

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -342,13 +342,7 @@ impl<'i> Formatter<'i> {
342342
sub.add_fragment_reference(Syntax::Neutral, " ");
343343
sub.add_fragment_reference(Syntax::Structure, "}");
344344
sub.flush_current();
345-
346-
let mut combined = String::new();
347-
for (_syntax, content) in &sub.fragments {
348-
combined.push_str(&content);
349-
}
350-
351-
vec![(Syntax::Structure, Cow::Owned(combined))]
345+
sub.fragments
352346
}
353347
}
354348
}
@@ -369,14 +363,7 @@ impl<'i> Formatter<'i> {
369363
sub.append_application(invocation);
370364
sub.flush_current();
371365

372-
// Combine all fragments into a single atomic fragment to prevent wrapping
373-
let mut combined = String::new();
374-
for (_syntax, content) in &sub.fragments {
375-
combined.push_str(&content);
376-
}
377-
378-
// Return as a single fragment
379-
vec![(Syntax::Invocation, Cow::Owned(combined))]
366+
sub.fragments
380367
}
381368

382369
fn render_binding(
@@ -409,13 +396,7 @@ impl<'i> Formatter<'i> {
409396
sub.append_variables(variables);
410397
sub.flush_current();
411398

412-
// Combine all fragments into a single atomic fragment to prevent wrapping
413-
let mut combined = String::new();
414-
for (_syntax, content) in &sub.fragments {
415-
combined.push_str(&content);
416-
}
417-
418-
vec![(Syntax::Structure, Cow::Owned(combined))]
399+
sub.fragments
419400
}
420401

421402
pub fn append_char(&mut self, c: char) {

0 commit comments

Comments
 (0)