Skip to content

Feature request: inline functions with if statements #76

@ntjess

Description

@ntjess

Consider this case:

#table(
  fill: (x, y) => if y == 0 { white.darken(15%) } else { none },
  align: (x, y) => if y == 0 { center } else { horizon },
  [Hi],
  [there],
)

The function definition is short (< line length) and clearly indicates parameter usage. typstyle reformats to:

#table(
  fill: (x, y) => if y == 0 {
    white.darken(15%)
  } else {
    none
  },
  align: (x, y) => if y == 0 {
    center
  } else {
    horizon
  },
  [Hi],
  [there],
)

which is arguably less readable.

My request is for inline ternary functions shorter than the user-specified line length to remain one-line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions