Problem formatting html when php code exists

PHP Tools [?] extends Visual Studio with set of advanced features to work more efficiently with PHP code.

Problem formatting html when php code exists

Postby Sachelis » January 14th, 2018, 5:26 pm

If I have an unformatted *.php file that contains a php tag:
Code: Select all
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test Page</title>
<?php ?>
</head>
<body>
<p>This is text and <a href="test.php">this</a> is a link.</p>
</body>
</html>

and I format it (Edit | Advanced | Format Document, aka Ctrl-K, Ctrl-D), it messes up the formatting. The fatal problem is that it removes the space after the "</a>" tag, in this case creating the word "thisis":
Code: Select all
<!DOCTYPE html>
<html lang="en">
<head>
   <title>Test Page</title>
   <?php ?>
</head>
<body>
   <p>
      This is text and
      <a href="test.php">this</a>is a link.
   </p>
</body>
</html>

Note that if I remove the php tag:
Code: Select all
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test Page</title>
</head>
<body>
<p>This is text and <a href="test.php">this</a> is a link.</p>
</body>
</html>

and format it, the formatting is correct:
Code: Select all
<!DOCTYPE html>
<html lang="en">
<head>
   <title>Test Page</title>
</head>
<body>
   <p>This is text and <a href="test.php">this</a> is a link.</p>
</body>
</html>

Note that this problem doesn't occur if PHP Tools is disabled and the file has an *.htm extension (in which case the formatting is "normal"). If PHP Tools is disabled and the file has a *.php extension, no formatting takes place.

This problem occurs regardless of where the php tag is in the file. It occurs if the contents of the php block is blank (as in the above examples), if it only contains a comment, or if it contains php code.

I'm using PHP Tools for Visual Studio version 1.25.10474.2017 and Visual Studio Community 2017 version 15.5.2.

The incorrect formatting, unfortunately, makes PHP Tool unusable for me. I'm hoping there is a solution, because I'm otherwise thrilled to be able to write and debug php in Visual Studio.
Sachelis
 
Posts: 4
Joined: January 12th, 2018, 11:36 pm

Re: Problem formatting html when php code exists

Postby Miloslav Beno » January 25th, 2018, 10:27 am

Hi,

Thank you so much for a bug report.

We've been able to reproduce. We are going to fix this one.

Thanks again,
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbenomiloslav@devsense.com
User avatar
Miloslav Beno
 
Posts: 1242
Joined: January 7th, 2012, 8:36 pm

Re: Problem formatting html when php code exists

Postby maros.beno » February 15th, 2018, 12:21 pm

Hi,
thanks for reporting this. Fix will be available in the next update, which should be available as preview version today.
Maroš Beňo
User avatar
maros.beno
 
Posts: 39
Joined: October 12th, 2016, 12:11 pm


Return to PHP Tools

Who is online

Users browsing this forum: No registered users and 1 guest

cron

User Control Panel

Login

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 89 on October 15th, 2018, 4:06 pm

Users browsing this forum: No registered users and 1 guest
Phalanger