eclipse-jdt / eclipse-jdt/eclipse.jdt.core

Granular Indentation Control for Specific Method Patterns (e.g., Stream.of())

Open
#3,917 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

[config (3).txt](https://github.com/user-attachments/files/19683938/config.3.txt)

Using the Eclipse formatter (via Spotless), we're currently limited by the global nature of the continuation_indentation setting. This results in undesired formatting when using chained methods like:

```
var stream = Stream.of(

[config (3).txt](https://github.com/user-attachments/files/19683922/config.3.txt)

item1,
item2
)
.flatMap(Collection::stream);
```
We'd like to customize indentation specifically for Stream.of() or similar method patterns to produce the following:

```
var stream = Stream.of(
// Desired: 8 spaces for arguments inside Stream.of()
item1,
item2
)
.flatMap(Collection::stream);
```
Problem

- continuation_indentation affects all method chains, so it's impossible to tune just one specific case.
-
- Formatting gets harder to read when method chains are involved, especially for deeply nested calls.
-
- We'd like more flexibility — such as per-method or per-pattern indentation control.

Request
Introduce a way to:

- Apply custom indentation levels based on method name or type.
-
- Optionally override continuation_indentation when a method is in a known list (like Stream.of, List.of, etc.)

Notes
We're using Eclipse formatter via Spotless, which just forwards to this engine. They've redirected us here for this enhancement.
Config PFA

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.