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 173937 - Indentation does not follow the previous line
Summary: Indentation does not follow the previous line
Status: VERIFIED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks: 174873
  Show dependency tree
 
Reported: 2009-10-07 09:22 UTC by Tomas Mysik
Modified: 2009-11-19 16:27 UTC (History)
1 user (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 Tomas Mysik 2009-10-07 09:22:37 UTC
The final code should look like this:

$checks[] = new G_Check("PHP version",
        version_compare(PHP_VERSION, MIN_PHP_VERSION, ">="),
        "The minimum version of PHP is ".MIN_PHP_VERSION);

If one starts typing, the first <enter> is indented by 4 spaces (or 1 tab). I manually adjust it to 8 spaces (or 2 tabs), but the next <enter> is indented
again by 4 spaces instead of 8, so the code look like this:

$checks[] = new G_Check("PHP version",
        version_compare(PHP_VERSION, MIN_PHP_VERSION, ">="),
    "The minimum version of PHP is ".MIN_PHP_VERSION);

One has to manually adjust every line, so it's very annoying (it works perfectly for Java).

P2 because it might be some bigger problem if the indentation does not follow the previous line.

Product Version: NetBeans IDE 6.8 Beta (Build 200910020947)
Java: 1.6.0_16; Java HotSpot(TM) 64-Bit Server VM 14.2-b01
System: Linux version 2.6.28-15-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 1 Tomas Mysik 2009-10-12 10:12:01 UTC
More serious example:

    function test() {
        do {
            echo "test";
        } while ($condition);             // press ENTER here
    |                                                // you will get here
    }
Comment 2 Filip Zamboj 2009-10-14 16:18:07 UTC
moreover, if you incoke formatting on the code above you will get this: 
<?
function test() {
    do {
        echo "test";
    } 
            while ($condition);| //press enter here 
        | //you end up here 
}

?>
the formatting issue was reported in 173906
Comment 3 Quality Engineering 2009-10-16 10:15:02 UTC
Integrated into 'main-golden', will be available in build *200910160201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/0db90a9db262
User: Filip Zamboj <fzamboj@netbeans.org>
Log: #173937 unit test created but commented out as the issue is still open
Comment 4 Tomas Mysik 2009-10-16 13:40:09 UTC
One more example:

    $arr = array(new ArrayIterator(array()), new ArrayObject(array()));|        // <- ENTER here => no indentation
Comment 5 Tomasz Slota 2009-10-16 14:25:31 UTC
Tomasi can you provide full context for the last example? I tried 

<?php
function functionName($param) {
    $arr = array(new ArrayIterator(array()), new ArrayObject(array()));|
}
?>

and some cases and didn't see any problem
Comment 6 Tomas Mysik 2009-10-16 14:49:13 UTC
<?php

    $arr = array(new ArrayIterator(array()), new ArrayObject(array()));

?>

Product Version: NetBeans IDE Dev (Build 091016)
Java: 1.6.0_16; Java HotSpot(TM) 64-Bit Server VM 14.2-b01
System: Linux version 2.6.28-15-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 7 Tomas Mysik 2009-10-16 14:49:33 UTC
<?php

    $arr = array(new ArrayIterator(array()), new ArrayObject(array()));

?>

Product Version: NetBeans IDE Dev (Build 091016)
Java: 1.6.0_16; Java HotSpot(TM) 64-Bit Server VM 14.2-b01
System: Linux version 2.6.28-15-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 8 Petr Pisl 2009-10-21 15:56:31 UTC
I have separated the issue with while into issue #175118. The issue with $arr = array(new ArrayIterator(array()), new 
ArrayObject(array())); as was mentioned by tmysik, now works after my fixes in indentation. I will create test for it. 
There is still the original problem with an expression over more lines. 
Comment 9 Tomas Mysik 2009-10-22 08:35:25 UTC
> There is still the original problem with an expression over more lines.

Personally, I would prefer behaviour like in Java - I mean indent by 8 spaces (2 tabs), not 4 (1), for expressions over
more lines.

Thanks a lot.
Comment 10 Tomas Mysik 2009-11-02 09:06:17 UTC
Another example:

<?php

    // 2b) load configuration from config.ini file
    Environment::loadConfig();                  // <-- press <enter> here

?>
Comment 11 Petr Pisl 2009-11-05 15:10:40 UTC
After committing change ae0db6ba4faa this can be marked as fixed. All mentioned are working now. 
Comment 12 Filip Zamboj 2009-11-19 16:27:56 UTC
verified
Product Version: NetBeans IDE Dev (Build 091119-840bbe3ddcb3)
Java: 1.5.0_17-ea; Java HotSpot(TM) 64-Bit Server VM 1.5.0_17-ea-b01