<?php if (true): ?>
  <div x-data='{
                                     "going": "right!"
                                  }'>
  </div>
<?php endif; ?>

The above sort of thing can happen if you're using alpine.js, but there's not actually any JS context involved; it does the same for just plain attribute content:

<?php if (true): ?>
  <div style='a
                    b
                    c'>
  </div>
<?php endif; ?>

Not sure how the code is in general, but seems possibly worth running format twice in automated tests, to verify that the second time is a noop? Depending on how robust the test suite is, might catch other instances of the same thing. It might be unfortunate to do on the client end, but you could also use the same technique to catch (and possibly report) errors from the extension (and not continuously change files every save). I'd opt in :)

    Hello Kris,

    Thank you again! :-)

    Easily replicable, will be fixed.

    Yes, acutally we have something like that in VS integration tests. All formatting tests run twice, the result should be the same. It make sense to do it for VS Code as well.

    Anyway I hope we will have most of the cases covered now. These "going right" creepers are all related to html formatting interacting with php formatting. .. but obviously you are never 100% sure.

    5 days later

    Yeah, for sure. Between PHP tags, heredocs, the fact that HTML is in the mix, css in html, javascript in html.... it sounds like a nightmare

      Kind of, yes :-) Anyway, I think we're getting there. This issue will be fixed in the upcoming pre-release.

      Thanks again, Kris!

        Write a Reply...