This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 148732 - Format doesn't work with code written in sigle line.
Summary: Format doesn't work with code written in sigle line.
Status: VERIFIED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker with 1 vote (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-30 13:03 UTC by Michael Nazarov
Modified: 2013-01-18 10:13 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Nazarov 2008-09-30 13:03:18 UTC
Product Version: NetBeans IDE Dev (Build 200809300201)
Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b12
System: Windows XP version 5.1 running on x86; Cp1251; ru_RU (nb)

In php file create followed line of code:
class a{function aa(){return;}}

Invoke context menu and select Format. Code will stay unchanged.

Same for loops like:
for($i=0;$i<10;$i++){echo $i;}
Comment 1 Mikhail Matveev 2008-09-30 13:33:39 UTC
Reproducible for me. Must be a regression.
Comment 2 Petr Pisl 2008-09-30 13:44:48 UTC
:) This is not a regression. We never had this functionality in php editor. We can add it in the next release. 
Comment 3 Michael Nazarov 2008-09-30 14:24:27 UTC
So now code formatting for PHP means indentation only?
Comment 4 Mikhail Matveev 2008-11-28 18:29:53 UTC
I think it would be nice to have it in 7.0
Comment 5 Filip Zamboj 2009-10-14 16:22:11 UTC
@tslota: 
did you fix this already or it is really a regression? 

this code: 
<?
function test() { do { echo "test"; } while ($condition); }
?>

is formatted correctly after invoking format on file

Product Version: NetBeans IDE Dev (Build 091014)
Java: 1.6.0_16; Java HotSpot(TM) 64-Bit Server VM 14.2-b01
Comment 6 Tomasz Slota 2009-10-27 10:18:19 UTC
It is not a regression. PHP formatting used to be only about adjusting line indents, the functionality for splitting lines have been only introduced recently and 
now it covers all the original examples provided in this report. The issue stays opened cos there are still some use cases to support, e.g. breaking lines in the 
switch statements
Comment 7 Tomasz Slota 2010-02-04 10:11:47 UTC
ppisl is the new owner of formatting/indentation area
Comment 8 Filip Zamboj 2010-03-02 09:02:48 UTC
Product Version: NetBeans IDE Dev (Build 100301-e67431be22c5)
Java: 1.6.0_16; Java HotSpot(TM) 64-Bit Server VM 14.2-b01

as stated in one of lasts comments there are some issues remaining 

example:
<? class a{function aa(){return;}} ?>

format file and the result is: 
<?

class a {

    function aa() {
        return;
}
}

?>

should be: 
<?
class a {
    function aa() {
        return;
    }
}
?>
Comment 9 Filip Zamboj 2010-03-02 09:17:05 UTC
(In reply to comment #8)
> Product Version: NetBeans IDE Dev (Build 100301-e67431be22c5)
> Java: 1.6.0_16; Java HotSpot(TM) 64-Bit Server VM 14.2-b01
> 
> as stated in one of lasts comments there are some issues remaining 
> 
> example:
> <? class a{function aa(){return;}} ?>
> 
> format file and the result is: 
> <?
> 
> class a {
> 
>     function aa() {
>         return;
> }
> }
> 
> ?>
> 
> should be: 
> <?
> class a {
>     function aa() {
>         return;
>     }
> }
> ?>

taking back expected result from previous comment. should be: 
<?

class a {
    function aa() {
        return;
    }
}

?>

blank lines are added by default, of course
Comment 10 Ondrej Brejla 2012-11-29 11:26:22 UTC
It has been fixed in some previous version.
Comment 11 Martin Kanak 2012-12-10 14:19:42 UTC
There is still problem with code formatting. Steps to reproduce:

1) Create a new PHP file
2) Copy/paste this code: <?php class a{function aa(){return;}} ?>
3) Then invoke context menu and select Format. 
Result:
<?php

class a {

    function aa() {
        return;
    }

} ?>

Should be:
<?php

class a {

    function aa() {
        return;
    }

}

?>

Product Version: NetBeans IDE Dev (Build 201212100001)
Java: 1.7.0_10-ea; Java HotSpot(TM) 64-Bit Server VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-ea-b17
System: Linux version 3.2.0-34-generic running on amd64; UTF-8; en_US (nb)
Comment 12 Ondrej Brejla 2012-12-10 14:25:25 UTC
It's another issue. Reported was:

<?php
class a{function aa(){return;}}
?>

And it works properly.

This: <?php class a{function aa(){return;}} ?>

doesn't work, but it doesn't work in 7.2 either. Definitely not P2. I'll try to look at it soon.
Comment 13 Ondrej Brejla 2012-12-10 15:11:17 UTC
I'll rather file new issue, since this old P2 is fixed. The new one is just cosmetic. Thanks.

New issue #223610
Comment 14 Ondrej Brejla 2012-12-10 15:12:06 UTC
See my last posts. Thanks.
Comment 15 Martin Kanak 2013-01-18 10:13:21 UTC
verified

Product Version: NetBeans IDE Dev (Build 201301170001)
Java: 1.7.0_10-ea; Java HotSpot(TM) 64-Bit Server VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-ea-b17