Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » Incorrectly formatting source code
Incorrectly formatting source code [message #558441] Sun, 12 September 2010 21:03 Go to next message
AntonioCS  is currently offline AntonioCS Friend
Messages: 2
Registered: September 2010
Junior Member
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 21:05]

Report message to a moderator

Re: Incorrectly formatting source code [message #628852 is a reply to message #558441] Fri, 24 September 2010 12:25 Go to previous message
dominik is currently offline dominikFriend
Messages: 122
Registered: July 2009
Senior Member
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: Mon Sep 23 15:13:42 GMT 2024

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

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

Back to the top