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.
if there is html code on the same line before open php tag '<?php', closing php tag '?>' indent will be zero. It is not suitable for php user and is not consistent with html formatter behavior. It seems that another condition necessary to reproduce issue is that related php code is spreaded into several php blocks. The following php code is formatted by php formatter: //-----start example------- <body><?php if ($a == 1){ ?> <br/><?php $r =123; ?><br/> <?php } ?> </body> //-----end example ------- Problem:the following line indent is 0: '?><br/>' Note: separate php block with line 'if ($a == 1){' is necessary for reproducing an issue.
another problem in suggested example is that '$r =123;' has the same indent as 'if ($a == 1){'. The same php formatter makes '$r =123;' indent 1 tab more if you will place '<?php' on the separate line. Tomash, Should this be filed as separate issue?
It is probably the same problem (I will confirm it once the editor is usable again). Speaking short the core of the problem is that now there is no formatter for the top-level PHP language, only for the embedded sections
Vito please evaluate if this issue is still valid in the current implementation
Yes, this is still a problem. I assume the expected formatting is: <body><?php if ($a == 1){ ?> <br/><?php $r =123; ?><br/> <?php } ?> </body> Is that correct? Currently the formatter does not work with disjoint sections, which is causing this problem.
The number of next version is already known -> moving from TM Dev to 6.5
Downgrading to P3
consider code like: <body> <?php if ($a == 1) { ?> <br/> <?php $r =123; ?> <br/> <?php } ?> </body> invoke formatting and you get: <body> <?php if ($a == 1) { ?> <br/> <?php $r =123; ?> <br/> <?php } ?> </body> a. ?> tags were moved to next line, why? b. the last code <?php } ?> is formatted wrong the expected result here is: <body><?php if ($a == 1) { ?> <br/> <?php $r =123; ?> <br/> <?php } ?> </body> However I don't really see how if should be handled .. but I suggested it above :). the example of original reporter is still formatted wrong. The result of his example is: <body><?php if ($a == 1) { ?> <br/><?php $r =123; ?><br/> <?php } // this is correct, see the first example in this comment. there is a difference for some reason. ?> // this one is weird, why here, it looks like it is out of scope </body> Product Version: NetBeans IDE Dev (Build 091014) Java: 1.6.0_16; Java HotSpot(TM) 64-Bit Server VM 14.2-b01
I fixed the part with unwanted splitting of lines described by fzamboj: http://hg.netbeans.org/web-main/rev/89c0e3932273
@tslota: I added few formatting unit tests to part that was supposed to be fixed. they are failing, though :(:(. Could you have a look? I think tests are fine. You can find them in formatting/qa/14273_x.php where _x is number > 0 and < 4 ;).
Integrated into 'main-golden', will be available in build *200910230201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/f512b5091bc7 User: Filip Zamboj <fzamboj@netbeans.org> Log: #124273 unit tests added - more complex cases are still missing
*** Issue 175425 has been marked as a duplicate of this issue. ***
as pe agreement with Filip this issue will be merged with issue 175229 *** This issue has been marked as a duplicate of 175229 ***