How to keep PHP opening tags left-aligned in VScode code formatting?

29 views Asked by At

I'm trying to setup a VSCode formatting rule which would keep all opening PHP tags on the leftmost side of the editor (no tabs), while formatting the rest of the code accordingly... I am currently using Intelephense to format the code.

Before:

    <?php
if ($dropdownVal == 1) {
    echo "<h2 class='comingSoon'>COMING SOON...</h2>";
};
?>

<?php if ($dropdownVal <= 5) { ?>
    <?php
    if ($page->d_left) {
        echo $page->d_left;
    }
    ?>

Desired outcome:

<?php
if ($dropdownVal == 1) {
    echo "<h2 class='comingSoon'>COMING SOON...</h2>";
};
?>

<?php if ($dropdownVal <= 5) { ?>
<?php
    if ($page->d_left) {
        echo $page->d_left;
    }
?>

Searching has not found a satisfactory answer. I hope my question makes sense. Any tips welcome!

0

There are 0 answers