google / google/xls

Continuation of expression removes indentation

Open
#1,196 3 comments 0 reactions 0 assignees View on GitHub
bug dslx dslx:fmt
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

Consider the following with a long expression that is continued at the next line with appropriate indentation:

```rust
fn foo(some_value: u32) -> u32 {
some_value + some_value + some_value + some_value + some_value + some_value + some_value +
some_value
}
```

The formatter removes this indentation of the continuation and starts the continuation in the column the original expression started:

```rust
fn foo(some_value: u32) -> u32 {
some_value + some_value + some_value + some_value + some_value + some_value + some_value +
some_value
}
```

I suspect aligning the continuation with the beginning of the original expression is only an issue in free-standing expressions used as a 'return from something' situation. In assignments, the current behavior produces good results as the indentation is given by the assignment in the line above:

```rust
fn foo(some_value: u32) {
let a = some_value + some_value + some_value + some_value + some_value + some_value + some_value +
some_value;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.