RiFi2k / format-html-in-php

Basically this vscode extension uses all your standard configurations for html formatting, and your standard configurations for format on save, etc. It more or less works exactly how vscode should already work as it pertains to HTML in PHP files.
The Unlicense
33 stars 6 forks source link

Extension suddenly stopped working #29

Closed zemanyak closed 5 years ago

zemanyak commented 5 years ago

Hello and thank you for this useful extension.

I've been using it quite a lot and I've been very satisfied with it. Yesterday it just stopped working all of a sudden and I can't get it to work again.

I tried everything I could think of : uninstall/reinstall extension, delete extension folder, update VSC... I even tried to reinstall Visual Studio Code and all the extensions from scratch.

My PHP is formatting correctly on save.

Here are my settings

{ "workbench.colorTheme": "Atom One Light", "php.executablePath": "D:\Documents\wamp64\bin\php\php7.1.9\php.exe", "php.validate.executablePath": "D:\Documents\wamp64\bin\php\php7.1.9\php.exe", "editor.renderWhitespace": "none", "editor.minimap.enabled": false, "editor.renderControlCharacters": false, "breadcrumbs.enabled": false, "terminal.integrated.shell.windows": "C:\Windows\System32\cmd.exe", "editor.wordWrap": "on", "update.enableWindowsBackgroundUpdates": false, "update.mode": "manual", "phpfmt.php_bin": "D:\Documents\wamp64\bin\php\php7.1.9\php.exe", "[php]": { "editor.formatOnSave": true }, "phpfmt.passes": [ "AlignPHPCode", "StripSpaceWithinControlStructures" ] }

Any idea ?

RiFi2k commented 5 years ago

Still having this issue?

zemanyak commented 5 years ago

Yep. It never worked again.

RiFi2k commented 5 years ago

Did you ever try deactivating all the other plugins to see if it was a conflict?

Then make a php file like test.php

<?php
/**
 * Test
 */

?>
    <span></span>

Then either right click and choose Format HTML in PHP or save the file. Should look like this if it's working as expected.

<?php
/**
 * Test
 */

?>
<span></span>
zemanyak commented 5 years ago

Only the HTML outside of the PHP is formated.

This

<?php
/**
 * Test
 */
echo '<span>
                <div>
                </div>
                        </span>'
?>
        <span></span>;

Becomes this

<?php
/**
 * Test
 */
echo '<span>
                <div>
                </div>
                        </span>';
?>
<span></span>
RiFi2k commented 5 years ago

This is expected behavior it skips everything inside a PHP tag. This is not for formatting any part of the PHP code, this strictly formats the HTML code outside of the PHP tags.

I don't think I would be able to support formatting HTML inside of a PHP echo.