PHP Tools not formatting code?
15 posts
• Page 1 of 2 • 1, 2
PHP Tools not formatting code?
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?
I am using VS2012, any suggestions?
- xdev
- Posts: 8
- Joined: August 23rd, 2012, 2:26 pm
Re: PHP Tools not formatting code?
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
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. │ @miloslavbeno │ miloslav@devsense.com
-
Miloslav Beno - Posts: 1252
- Joined: January 7th, 2012, 8:36 pm
Re: PHP Tools not formatting code?
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!
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?
Ah, I see what you mean! You are expecting the code to format like this?
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?
- 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. │ @miloslavbeno │ miloslav@devsense.com
-
Miloslav Beno - Posts: 1252
- Joined: January 7th, 2012, 8:36 pm
Re: PHP Tools not formatting code?
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.
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?
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.
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. │ @miloslavbeno │ miloslav@devsense.com
-
Miloslav Beno - Posts: 1252
- Joined: January 7th, 2012, 8:36 pm
Re: PHP Tools not formatting code?
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
Cheers
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbeno │ miloslav@devsense.com
-
Miloslav Beno - Posts: 1252
- Joined: January 7th, 2012, 8:36 pm
Re: PHP Tools not formatting code?
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?
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. │ @miloslavbeno │ miloslav@devsense.com
-
Miloslav Beno - Posts: 1252
- Joined: January 7th, 2012, 8:36 pm
Re: PHP Tools not formatting code?
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
http://www.youtube.com/watch?v=u-mbv5HtsIY
- xdev
- Posts: 8
- Joined: August 23rd, 2012, 2:26 pm
15 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 15 guests