Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 172128

Summary: PHPdoc blocks are ignored by the formatter action
Product: z_Archived Reporter: Gadi Goldbarg <gadi>
Component: PDTAssignee: Guy Gurfinkel <guy.g>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P2 Keywords: plan
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Windows XP   
Whiteboard:

Description Gadi Goldbarg CLA 2007-01-30 04:31:08 EST
Copy the following text to the editor and click CTRL+Shift+F, the PHPdoc block 
stays at the same location:
<HTML>
<BODY>
<H1>Debug Demo</H1>
<table border="1" width="700">
<tr bgcolor="red">
	<th>Name</th>
	<th>Address</th>
	<th>Phone</th>
</tr>
<?php
$db = array(
		array ("John", "E 10th St., NYC, NY 23742", "(212) 555-4456"),
		array ("Francois", "12 Bd. de Grenelle, Paris, 74897","(33) 433-544"),
		array ("Klaus", "312 Beethoven St., Frankfurt, Germany", "(44) 332-8065"),
		array ("Shirly", "72 Independence St., Tel Aviv, Israel 67283", "(972) 
156-7777"),
		array ("Bill", "127 Maine St., San Francisco, CA 90298", "(415) 555-6565")
	  );

/**
 * @return string
 * @param i int
 * @desc Returns 'white' for even numbers and 'yellow' for odd numbers
 */
function row_color($i)
{
	$bgcolor1 = "white";
	$bgcolor2 = "yellow";

	if ( ($i % 2) == 0 ) {
		return $bgcolor1;
	} else {
		return $bgcolor2;
	}
}

</BODY>
</HTML>
Comment 1 moshe CLA 2007-01-30 06:59:30 EST
To fix this bug replace the method in PhpFormatter(line 293):
private boolean shouldReformat(IStructuredDocument document, IRegion lineInfo) {
	final String checkedLineBeginState = FormatterUtils.getPartitionType(document, lineInfo.getOffset());
	return ((checkedLineBeginState == PHPPartitionTypes.PHP_DEFAULT) || 
		(checkedLineBeginState == PHPPartitionTypes.PHP_MULTI_LINE_COMMENT) || 
		(checkedLineBeginState == PHPPartitionTypes.PHP_SINGLE_LINE_COMMENT) || 
		(checkedLineBeginState == PHPPartitionTypes.PHP_DOC));
	}
Comment 2 Guy Gurfinkel CLA 2007-01-30 07:13:15 EST
fixed, thanks moshe.
Comment 3 Gadi Goldbarg CLA 2007-01-31 03:53:34 EST
fixed