1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// SPDX-License-Identifier: MIT
//! A Wadler-Lindig pretty-printing engine.
//!
//! Build a [`Doc`] tree that describes the *structure* of your output, then let
//! the printer decide where to break lines based on the available width. The
//! core idea: [`group`] marks a subtree as a flat/break decision boundary — the
//! printer tries to render it on one line and falls back to multi-line only when
//! the content would exceed [`FormatOptions::print_width`].
//!
//! # Quick start
//!
//! ```
//! use rlsp_fmt::{Doc, concat, group, indent, line, text, format, FormatOptions};
//!
//! // Build a document: "[" <items> "]"
//! let doc = group(concat(vec![
//! text("["),
//! indent(concat(vec![line(), text("a"), text(","), line(), text("b")])),
//! line(),
//! text("]"),
//! ]));
//!
//! let opts = FormatOptions { print_width: 80, ..Default::default() };
//! assert_eq!(format(&doc, &opts), "[ a, b ]");
//!
//! // Narrow width forces the group to break.
//! let opts_narrow = FormatOptions { print_width: 5, ..Default::default() };
//! assert!(format(&doc, &opts_narrow).contains('\n'));
//! ```
//!
//! See [`FormatOptions`] for all rendering controls.
/// Intermediate representation types for the pretty-printing engine.
/// The Wadler-Lindig line-breaking printer.
pub use ;
pub use format;
/// Options that control how a document is rendered.