eclipse-jdt / eclipse-jdt/eclipse.jdt.ui
eclipse java formatter: auto-wrapped control statement indent broken
- Dominant language
- Java
- Stars
- 59
- Forks
- 127
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 35
Description
When compound control statements have a clause that is auto-wrapped the statement indentation is compounded instead of lining up. The expected behavior is for control statements and their blocks at the same control level to line up (statements line up, blocks line up but indented by one). Instead they all drift to the right.
Below is an example. Note how all control statements are at the "same level" of control, but subsequent statement and block indent is compounding, with the statements and their blocks drifting to the right instead of being aligned....
Angle pdi; // same sense as drift
if (_isAzimuthGyroOn && !_isBombsightEngaged && _isAutopilotEngaged) {
// autopilot stabilized: PDI tracks only gyro,
/// angle sense is stab to gyro angle
Angle gyroAzi = _aziGyroHeading.subtract(_stabHeadingCont);
/// angle sense is gyro to auto clutch
Angle autoAzi = gyroAzi.add(gyroAutoOffset);
pdi = autoAzi; // auto clutch is PDI
} else if (_isAzimuthGyroOn && _isBombsightEngaged
&& !_isAutopilotEngaged) {
// sighthead stabilized: PDI tracks gyro + drift offsets
/// angle sense is stab to sighthead
Angle drift = computeSightDrift(gyroSightOffset, gyroAutoOffset,
turnKnobOffset, driftKnobOffset);
/// angle sense is sighthead to PDI
pdi = drift.add(driftKnobOffset);
} else if (_isAzimuthGyroOn && _isBombsightEngaged
&& _isAutopilotEngaged) {
// sighthead stabilized but auto clutch also engaged: PDI
// tracks only gyro
Angle gyroAzi = _aziGyroHeading.subtract(_stabHeadingCont);
/// angle sense is gyro to auto clutch
Angle autoAzi = gyroAzi.add(gyroAutoOffset);
/// auto clutch is PDI
pdi = autoAzi;
} else {
// unstabilized: PDI tracks manual turn knob ???
/// angle sense is sighthead to PDI
pdi = _driftAngle.add(driftKnobOffset);
}
return pdi;
Contributor guide
Research direction
Start by reproducing the supplied compound control-statement example with the Eclipse Java formatter and inspect the formatter behavior for auto-wrapped clauses. Compare the output with the expected alignment described in the issue; done means statements and blocks at the same control level no longer compound their indentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100