phpeclipseformatterphpeclipse

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 there 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. :)


Solution

  • 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