Menu

#598 Issue with indenting if without brackets and if-else (with or without brackets) when in a lambda block.

open
nobody
None
2025-07-29
2025-03-31
No

Issue with indenting if without brackets and if-else (with or without brackets) when in a lambda block.

astyle parameters
--indent=spaces=3 --indent-switches --max-continuation-indent=80 --indent-lambda --pad-include --keep-one-line-blocks --keep-one-line-statements --indent-col1-comments --min-conditional-indent=0 --pad-comma --pad-header --attach-namespaces --align-pointer=middle --align-reference=middle

Discussion

  • Francis CLERC

    Francis CLERC - 2025-03-31

    With example 1

     
  • Francis CLERC

    Francis CLERC - 2025-03-31

    With example 3

     
  • w-peuker

    w-peuker - 2025-03-31

    Could you please add your examples as text like this:

    ```cpp 
    verbatim copy
    of your code
    section
    goes here
    ```
    

    The images are very small and are placed in the wrong place when clicked. In addition, they cannot be copied to easily verify the problem and possible fixes.

    And finally: Which Artistic Style version do you use?

     

    Last edit: w-peuker 2025-03-31
  • André Simon

    André Simon - 2025-07-22

    Please try with 3.6.10.

     
  • Francis CLERC

    Francis CLERC - 2025-07-25

    Hello Simon,
    Thank you for your reply an for looking at this,
    Unfortunately I tested on the version 3.6.10 and it seems that the lamdas are no longer indented

    Original indenting

    int func()
    {
       auto addLambda = [](int a, int b)
             {
                return a + b;
             };
    }
    

    Then I run
    astyle-3.6.10-x64> .\astyle.exe --style=allman --indent=spaces=3 --indent-lambda MyFile.c

    Which gives me

    int func()
    {
       auto addLambda = [](int a, int b)
       {
          return a + b;
       };
    }
    

    While in version 3.6.7 I have

    int func()
    {
       auto addLambda = [](int a, int b)
                        {
                           return a + b;
                        };
    }
    
     

    Last edit: Francis CLERC 2025-07-25
  • André Simon

    André Simon - 2025-07-29

    Thx, I pushed an update into the git repo

     

Log in to post a comment.

MongoDB Logo MongoDB