Skip to main content



      Home
Home » Language IDEs » PHP Development Tools (PDT) » Incorrectly formatting source code
Incorrectly formatting source code [message #558441] Sun, 12 September 2010 17:03 Go to next message
Eclipse UserFriend
Eclipse format code option doesn't properly format code in if's.
I have the following lines of code:
		$cfile = sha1($keyname);
		$cpath = $this->_cache_dir;

		if (isset($options['subdir']))
			$cpath .= $options['subdir']; //Must have ending /

		return $cpath . $cfile;


The line after the if statement doesn't get the tab it should have. It becomes like this:
		if (isset($options['subdir']))
		$cpath .= $options['subdir']; //Must have ending /


Is there any way to fix this?
I am using the Helios version on Win7 64bit

[Updated on: Sun, 12 September 2010 17:05] by Moderator

Re: Incorrectly formatting source code [message #628852 is a reply to message #558441] Fri, 24 September 2010 08:25 Go to previous message
Eclipse UserFriend
On 2010-09-12 23:03, AntonioCS wrote:
> if (isset($options['subdir']))
> $cpath .= $options['subdir']; //Must have ending /
> The line after the if statement doesn't get the tab it should have. It becomes
> like this:
> if (isset($options['subdir']))
> $cpath .= $options['subdir']; //Must have ending /
> Is there any way to fix this?

This is correct.
Use bracket instead of shortened notation.

{{{
if (isset($options['subdir'])) {
$cpath .= $options['subdir'];
}
}}}

BTW: I'm using external formatter and it will merge Your code into one line.
It's designed to perform much more advanced reformatting, It's custom to keep
company policy about code. Also it's compatible with Eclipse so after all
Eclipse will not reformat more. This is comfortable to clear very old code and
later just to quickly reformat current via eclipse.

dmc
Previous Topic:Languages mixing in source code
Next Topic:wrong Design or Problem of PHP resp. PDT
Goto Forum:
  


Current Time: Fri Jul 04 17:51:50 EDT 2025

Powered by FUDForum. Page generated in 0.03483 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top