Hi Jim,

Thank you for your post.

The last update indeed changed the formatter. We've used a completely rewritten implementation which is much more powerful and customizable then the previous one. The issue is, not all the customizations were available through the formatting GUI options... We are working on it now.

The option you want in this case is Keep control statements on one line and you would want automatically formatting on semi-colon turned on.

I will inform you, once we have the formatting options available so you can try that out.

Thank you!

    11 days later

    Hi Jim,

    The formatting options will be available in the next update, which will be out very soon. There are going to be many options, but we will be adding new ones according to feedback.

    Thank you!

      Sounds great, thanks and looking forward to it!

        • Edited

        @MiloslavBeno while you're on that:

        if( x ) {
        }

        controls without a space before parenthesis would be great!
        I can't find a setting for it right now so it always turns to if ()

        thanks!

          Hi tob,

          Thank you.

          Yes, this option is coming soon too:

            Hi
            the conversion from array() to [] I think is not already present in the formatting method, is it true?

            Hi, I just tested the updated formatter, almost there.

            I still have the problem with the single line control statements. As shown in my original post, as soon as I add the semicolon it wraps. I've checked Keep control statements on one line under Wrapping, but it wraps.

            Any suggestions on what I am missing?

              Hi Jim,

              You are correct, there is a minor issue in the latest version which unfortunately affects this option. The update will be prepared soon.

              Thank you!

                MaoDev Correct, we do not have that option. At this stage, we basically only alter whitespaces and do not touch characters, but we'll get there ;-)

                  5 days later

                  Hi Jim,

                  Please try the latest release, Keep control statements on one line should work correctly there.

                  Thank you!

                    Okay, that worked, but introduced another issue.

                    This is specifically a problem with alternate syntax (vs. using curly brackets). It does not occur when using curly brackets. This problem seems restricted specifically to the foreach statement, I've tried for, while, do, switch and so on and all of those work as expected.

                    Given the following as the first foreach statement in the PHP script:

                    foreach( $item as $key ):
                    ----endforeach

                    When I add the semicolon it formats properly:

                    foreach( $item as $key ):
                    endforeach;`

                    With every new foreach statement in the script, though, the moment I add the semicolon, the first line of the statement jumps up and appends itself to the end of the line after the last semicolon, as such:

                    Expected:

                    foreach ( $item as $key ):
                    endforeach; 
                    
                    $b = 2;
                    
                    foreach ( $test as $error ):
                    endforeach;

                    What occurs:

                    endforeach; 
                    
                    $b = 2; foreach ( $test as $error ):
                    endforeach;

                    This occurs no matter what the previous line contains or does, if there is a semicolon there, adding the semicolon to the endforeach to close the statement causes the formatting issue.

                    This also occurs if I am pasting a foreach block into a function or page, as soon as I paste the block, the first line jumps to the end of the last line with a semicolon.

                    Any thoughts?

                      Thank you and sorry for the issue, I've been able to replicate this. We will fix that one asap.

                        This is fixed and will be available in the next update.

                        I'm closing this one, please if you run into anything else open a new thread.

                        Thank you!

                          Write a Reply...