php - Eclipse PDT code folding problem

796

I've recently been using Eclipse with PDT for PHP development.

When writing classes I tend to use the following style for class constants and properties:

class Foo extends Bar
{
    const
        CNST_1 = 1,
        CNST_2 = 2,
        CNST_3 = 3;

    private
        $fred = array(),
        $barney = array ();

    public
        $wilma = 123,
        $betty = 456;
}

Unfortunately code folding makes something of a mess of this if I have fold code on load turned on. It ends up looking like this:

class Foo extends Bar
{
        CNST_3 = 3;

        $barney = array ();

        $betty = 456;
}

The code unfold control is there, but clicking it only reveals one extra row of my source file each time until it get to the const, public, private etc part. Then clicking the folding box only hides the first item after the keyword.

Has anyone else hit this issue, and if so what did they do about it?

650

Answer

Solution:

I don't know PDT very well, but on PHPeclipse you can solve this by:

Window -> Preferences -> PHPeclipse -> PHP and then in the tab "Folding" unselect all default settings.

For PDT I recomend you, to search for this setting by simply seraching in the preferences forfolding orPHP.

People are also looking for solutions to the problem: PHP Set Variable if Empty?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.