PHP Tools not formatting code?

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

PHP Tools not formatting code?

Postby xdev » August 23rd, 2012, 7:47 pm

Using the ubiquitous formatting shortcut (Ctrl-K, Ctrl-D) does not format any php code even though the options are enabled. Cut n' Paste formatting does nothing as well.

I am using VS2012, any suggestions?
xdev
 
Posts: 8
Joined: August 23rd, 2012, 2:26 pm

Re: PHP Tools not formatting code?

Postby Miloslav Beno » August 23rd, 2012, 10:17 pm

Hello,

Formatting might not work in three cases:
- syntax error in your code. We are working on this by making our parser more robust, so it could recover itself from errors.
- In Basic version - free license
- ? yet unsupported syntax

Could you please attach source code which can't be formated? I'll take a look.

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

Re: PHP Tools not formatting code?

Postby xdev » August 23rd, 2012, 10:52 pm

Attached as requested (added .txt to allow upload)

One thing to note, if I place my cursor in front of curly brace and hit enter, it will properly indent the code.

Also, this is a purchased version.

Thanks!
You do not have the required permissions to view the files attached to this post.
xdev
 
Posts: 8
Joined: August 23rd, 2012, 2:26 pm

Re: PHP Tools not formatting code?

Postby Miloslav Beno » August 23rd, 2012, 11:15 pm

Ah, I see what you mean! You are expecting the code to format like this?

Code: Select all
<?php
$t = 1;
if($t > 0){
    echo "No love on the format";
}
?>


The formatting feature just follows conventions of other VS languages, which means in this case a block on single line stays on single line. However this default behaviour can be modified with option as in C# ( Formatting > Wrapping > Leave block on single line [Unchecked]). We don't support it in current release, but it's already planned.

I'll give it higher priority if it's what you've ment?
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbenomiloslav@devsense.com
User avatar
Miloslav Beno
 
Posts: 1252
Joined: January 7th, 2012, 8:36 pm

Re: PHP Tools not formatting code?

Postby xdev » August 24th, 2012, 2:30 am

So looking at this page (http://www.devsense.com/products/php-tools/features), the screenshot shows that formatting I expect to occur. Actually I typed that code block and still not formatting occurs.

Also, unchecking the 'keep block on single line' has no effect.
xdev
 
Posts: 8
Joined: August 23rd, 2012, 2:26 pm

Re: PHP Tools not formatting code?

Postby Miloslav Beno » August 24th, 2012, 8:46 am

This code should be formatted as on screenshort when pressing Ctrl+K,D or when selecting the complete code block and pressing Ctrl+K,F.

If this doesn't work I would have to investigate further.

However the code block isn't formatted automaticaly when you terminate block by typing endif; that just works with {} blocks.

'Keep block on single line' isn't supported yet, I'll try to introduce it in the next update.
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbenomiloslav@devsense.com
User avatar
Miloslav Beno
 
Posts: 1252
Joined: January 7th, 2012, 8:36 pm

Re: PHP Tools not formatting code?

Postby Miloslav Beno » August 24th, 2012, 11:32 am

I have "Leave block on single line" option almost ready. I'll have to create tests for it to be ready for release. But I can put it into private beta for now, so you can try it...

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

Re: PHP Tools not formatting code?

Postby xdev » August 24th, 2012, 12:24 pm

Perfect, I would be happy to test it out.
xdev
 
Posts: 8
Joined: August 23rd, 2012, 2:26 pm

Re: PHP Tools not formatting code?

Postby Miloslav Beno » August 24th, 2012, 7:19 pm

Great! You should have access to private beta releses section now. The newest one there contains Wrapping formatting option for PHP and some more stuff. Plese give it a try and give us know if it works as you'd expected.
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbenomiloslav@devsense.com
User avatar
Miloslav Beno
 
Posts: 1252
Joined: January 7th, 2012, 8:36 pm

Re: PHP Tools not formatting code?

Postby xdev » August 24th, 2012, 8:34 pm

That did not seem to affect anything. I have created a screencast so you can see exactly what is happening, maybe you'll spot something:

http://www.youtube.com/watch?v=u-mbv5HtsIY
xdev
 
Posts: 8
Joined: August 23rd, 2012, 2:26 pm

Next

Return to PHP Tools

Who is online

Users browsing this forum: No registered users and 18 guests

cron

User Control Panel

Login

Who is online

In total there are 18 users online :: 0 registered, 0 hidden and 18 guests (based on users active over the past 5 minutes)
Most users ever online was 787 on May 12th, 2024, 11:50 am

Users browsing this forum: No registered users and 18 guests