How can I configure the formatter settings in PhpEclipse?
I'm using Eclipse Helios with PHPEclipse, which works great, but I can't seem to get the formatter (Ctrl-Shift-F) to work with highlighted code. It doesn't really seem to do anything. Does anyone know if ther开发者_运维百科e is a way to edit the settings (i.e. import/export formatter settings, like in Eclipse Java) for PHPEclipse?
Basically, my problem is that it doesn't even do anything reasonable. If I have:
class SomeClass {
function myFunc() {
if (isEnabled()
)
{
// do something
}
}
}
It won't move the brackets to the correct indentation. If it could even do that, I would be happy. :)
Select your code and hit Ctrl + I this will format the above code as follows:
class SomeClass {
public function myFunc() {
if (isEnabled()
)
{
// do something
}
}
}
As far as I can find the only thing you can actually set relating to format is weather or not to use spaces or tabs for indentation.
Windows -> Preferences
Then:
PHP -> Code Style -> Formatter
This is for Eclipse PDT!
From the top menu go to Window > Preferences
From the left side click on PHP to expand all of the settings for PHP.
Click Code Style to edit the code templates for PHP
In my eclipse installation, the result of formating your code
class SomeClass {
function myFunc() {
if (isEnabled()
)
{
// do something
}
}
}
Hope this helps
精彩评论