Page 1 of 1

VS HTML Code Formatter breaks dynamic PHP

PostPosted: February 10th, 2017, 4:24 pm
by silas2
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?

Re: VS HTML Code Formatter breaks dynamic PHP

PostPosted: February 17th, 2017, 2:43 pm
by Miloslav Beno
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!

Re: VS HTML Code Formatter breaks dynamic PHP

PostPosted: February 23rd, 2017, 7:43 pm
by silas2
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.

Re: VS HTML Code Formatter breaks dynamic PHP

PostPosted: February 24th, 2017, 2:15 pm
by Miloslav Beno
Hello!

Have you assigned phtml files to PHP Editor? https://docs.devsense.com/#file-extension-being-opened-by-php-editor

Re: VS HTML Code Formatter breaks dynamic PHP

PostPosted: February 24th, 2017, 6:08 pm
by silas2
Doh!! Thank you so much, that's fixed it. RTFM.

Re: VS HTML Code Formatter breaks dynamic PHP

PostPosted: February 27th, 2017, 10:54 am
by Miloslav Beno
hehe :-) No problem, I'm glad it was that simple.

Have a good one!