VHDLFormatter icon indicating copy to clipboard operation
VHDLFormatter copied to clipboard

Propose: improving `if` statement with multiline conditions

Open Nabav opened this issue 1 year ago • 1 comments

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 avatar Dec 13 '23 08:12 Nabav

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.

Nabav avatar Dec 13 '23 10:12 Nabav