VS HTML Code Formatter breaks dynamic PHP

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

VS HTML Code Formatter breaks dynamic PHP

Postby silas2 » February 10th, 2017, 4:24 pm

Great product by the way, I use it all day!
But my problem is I'm working on dynamic html/php (Magento) and the VS html window formatter (Ctrl-k, Ctrl-D but it seems to run the procedure without human intervention as well) breaks the escaped php code, e.g.
Code: Select all
    <input id="search" type="text" name="<?php echo $this->helper('catalogsearch')-blah blah

turns into:
Code: Select all
    <input id="search" type="text" name="" <?php echo $this->helper('catalogsearch')-blah blah

which doesn't look too bad, but my oh my does it make for some subtle bugs!
I know I should search/replace for two double quotes after working on every file, but I just don't remember.
Is there something obvious I'm missing?
silas2
 
Posts: 5
Joined: February 10th, 2017, 4:13 pm

Re: VS HTML Code Formatter breaks dynamic PHP

Postby Miloslav Beno » February 17th, 2017, 2:43 pm

Hello!

Thanks for the feedback. We're very glad PHP Tools help you every day ;-)

This really seems as a bug. What VS version do you use? and do you have other extensions? I suspect this is not coming from our formatter, maybe default html formatter is somehow activated(we deactivate it and use our own) and messes up the stuff.

Could you send me the whole html code snippet where this happens?

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

Re: VS HTML Code Formatter breaks dynamic PHP

Postby silas2 » February 23rd, 2017, 7:43 pm

I'm using VS2015.
This is looking like a most spooky issue (to me anyway!). I download magento source, create new VS project from existing code.
None of the Magento files get syntax highlighting (and exhibit the formatting issue) in html designer, but when I add a new file pasting the same content as an original Magento souce, and I get full syntax highlighting and bug gone away.
I do a binary + hex comparison of the two files content and they are exactly the same!!! (no Encoding/line ending differences)
I look at the two files in the .proj file (orignal.phtml and test.phtml) and the entries look the same.
I really am scratching my head.
silas2
 
Posts: 5
Joined: February 10th, 2017, 4:13 pm

Re: VS HTML Code Formatter breaks dynamic PHP

Postby Miloslav Beno » February 24th, 2017, 2:15 pm

Hello!

Have you assigned phtml files to PHP Editor? https://docs.devsense.com/#file-extension-being-opened-by-php-editor
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbenomiloslav@devsense.com
User avatar
Miloslav Beno
 
Posts: 1002
Joined: January 7th, 2012, 8:36 pm

Re: VS HTML Code Formatter breaks dynamic PHP

Postby silas2 » February 24th, 2017, 6:08 pm

Doh!! Thank you so much, that's fixed it. RTFM.
silas2
 
Posts: 5
Joined: February 10th, 2017, 4:13 pm

Re: VS HTML Code Formatter breaks dynamic PHP

Postby Miloslav Beno » February 27th, 2017, 10:54 am

hehe :-) No problem, I'm glad it was that simple.

Have a good one!
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbenomiloslav@devsense.com
User avatar
Miloslav Beno
 
Posts: 1002
Joined: January 7th, 2012, 8:36 pm


Return to PHP Tools

Who is online

Users browsing this forum: No registered users and 2 guests

cron

User Control Panel

Login

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 5 minutes)
Most users ever online was 62 on January 7th, 2012, 10:54 pm

Users browsing this forum: No registered users and 2 guests
Phalanger