g2384 / VHDLFormatter

VHDL formatter web online written in typescript
https://g2384.github.io/VHDLFormatter/
MIT License
52 stars 20 forks source link

Propose: improving `if` statement with multiline conditions #70

Open Nabav opened 11 months ago

Nabav commented 11 months ago

Report a bug

Input and also Expected Behavior

The end of multi-line conditions ) then should be outdented in the next line to be at the same indentation level as if (.

if (
    long_condition_1
    or long_condition_2
) then
    x <= '1';
else
    x <= '0';
end if;

Actual Behavior

The end of multi-line conditions ) then is indented at the same level of conditions and also statements in the if body.

if (
    long_condition_1
    or long_condition_2
    ) then  -- should not be indented
    x <= '1';
else
    x <= '0';
end if;
Nabav commented 11 months ago

In general, if some parenthesis or bracket is opened at some line, but closed at other line, The closing line should be at the same indentation level of the opening line. The content between these lines should indented one level.