parent
2b7ca0e4a1
commit
2489e0fdd0
|
@ -9,7 +9,9 @@
|
|||
### Changed
|
||||
|
||||
- **aiken**: Rename `--filter_traces` to `--trace_filter` for more consistency with `--trace_level`. An alias for `--filter_traces` still exists for backward compatibility. @KtorZ
|
||||
- **aiken-project**: Fix `aiken docs` wrongly formatting list constants as tuples. See [#1048](https://github.com/aiken-lang/aiken/issues/1048). @KtorZ
|
||||
- **aiken-project**: Fix `aiken docs` source linking crashing when generating docs for config modules. See [#1044](https://github.com/aiken-lang/aiken/issues/1044). @KtorZ
|
||||
- **aiken-project**: Fix `aiken docs` generating very long lines for constants. @KtorZ
|
||||
|
||||
### Removed
|
||||
|
||||
|
|
|
@ -203,6 +203,22 @@ impl<T> From<Vec1Ref<T>> for Vec1<T> {
|
|||
}
|
||||
|
||||
impl TypedExpr {
|
||||
pub fn is_simple_expr_to_format(&self) -> bool {
|
||||
match self {
|
||||
Self::String { .. } | Self::UInt { .. } | Self::ByteArray { .. } | Self::Var { .. } => {
|
||||
true
|
||||
}
|
||||
Self::Pair { fst, snd, .. } => {
|
||||
fst.is_simple_expr_to_format() && snd.is_simple_expr_to_format()
|
||||
}
|
||||
Self::Tuple { elems, .. } => elems.iter().all(|e| e.is_simple_expr_to_format()),
|
||||
Self::List { elements, .. } if elements.len() <= 3 => {
|
||||
elements.iter().all(|e| e.is_simple_expr_to_format())
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn and_then(self, next: Self) -> Self {
|
||||
if let TypedExpr::Trace {
|
||||
tipo,
|
||||
|
|
|
@ -382,7 +382,18 @@ impl<'comments> Formatter<'comments> {
|
|||
.append(wrap_args(elems.iter().map(|e| (self.const_expr(e), false))).group())
|
||||
}
|
||||
TypedExpr::List { elements, .. } => {
|
||||
wrap_args(elements.iter().map(|e| (self.const_expr(e), false))).group()
|
||||
let comma: fn() -> Document<'a> =
|
||||
if elements.iter().all(TypedExpr::is_simple_expr_to_format) {
|
||||
|| flex_break(",", ", ")
|
||||
} else {
|
||||
|| break_(",", ", ")
|
||||
};
|
||||
|
||||
list(
|
||||
join(elements.iter().map(|e| self.const_expr(e)), comma()),
|
||||
elements.len(),
|
||||
None,
|
||||
)
|
||||
}
|
||||
TypedExpr::Var { name, .. } => name.to_doc(),
|
||||
_ => Document::Str(""),
|
||||
|
|
|
@ -22,7 +22,7 @@ use std::{
|
|||
time::{Duration, SystemTime},
|
||||
};
|
||||
|
||||
const MAX_COLUMNS: isize = 999;
|
||||
const MAX_COLUMNS: isize = 80;
|
||||
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
pub mod link_tree;
|
||||
|
|
Loading…
Reference in New Issue