Skip to content

Conversation

@Enter-tainer
Copy link
Collaborator

@Enter-tainer Enter-tainer commented May 26, 2024

fix #76

@Enter-tainer
Copy link
Collaborator Author

@ntjess you may see detailed comparsion here

@Enter-tainer Enter-tainer force-pushed the mgt/fold-single-item-code branch from 6aa8351 to 26dc8ee Compare May 28, 2024 14:26
@Enter-tainer Enter-tainer force-pushed the mgt/fold-single-item-code branch from 26dc8ee to eed47bd Compare June 29, 2024 11:47
@Enter-tainer Enter-tainer marked this pull request as ready for review June 29, 2024 16:30
@Enter-tainer
Copy link
Collaborator Author

Hi @ntjess I just add scoped based checking and only expr-like-if will be put in a single line(if possible). Would you mind look at the diff and comment the current behavior?

Comment on lines 62 to +65
#show raw.where(block: false): it => if it.text.starts-with("<") and it.text.ends-with(">") {
set text(1.2em)
doc-style.show-type(it.text.slice(1, -1))
} else {
it
}
} else { it }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look good. I suggest we only try put them in a single line iff both branch of if has exactly one item

return (node.y, node.x)
} else {
panic(message: "Invalid tree direction.")
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like currently else-if pattern is not well recognized. They should be stmt-like-if but not expr-like-if

Comment on lines 4222 to +4224
let last-row-size = if rows.len() == 0 {
auto
} else {
rows.last()
}
} else { rows.last() }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should either put the two branch in a single line, or we completely expand them. Current status doesn't look good.

Comment on lines +437 to +440
#let max-if-not-none(a, b) = if a in (none, auto) { b } else if b in (
none,
auto,
) { a } else { calc.max(a, b) }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: inline functions with if statements

3 participants