Skip to content

Add option to indent pipe operator continuation lines #967

@Wilsy99

Description

@Wilsy99

Title: Add option to indent pipe operator continuation lines

Description:

Currently, JuliaFormatter removes indentation from pipe operator (|>) continuation lines, making long pipe chains less readable.

Current behavior:

bars |>
EMA(10, 20) |>
CUSUM(1) |>
Crossover(:ema_10, :ema_20; direction=LongOnly) |>
@Event(:cusum  0, :side  0)

Desired behavior:

bars |>
    EMA(10, 20) |>
    CUSUM(1) |>
    Crossover(:ema_10, :ema_20; direction=LongOnly) |>
    @Event(:cusum  0, :side  0)

Requested Feature:

Add a configuration option (e.g., indent_pipe_continuation = true) that would preserve or add indentation to continuation lines after pipe operators.

Rationale:

  • Improves readability for long pipe chains
  • Common pattern in data processing pipelines (DataFrames.jl, data science workflows)
  • Aligns with how pipes are typically written by hand in the Julia community
  • Similar to method chaining indentation in other languages (JavaScript, Python)

Current workaround:
Using #! format: off comments, which disables all formatting for that section.

Configuration file tested:

style = "blue"
indent = 4
pipe_to_function_call = false
yas_style_nesting = true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions