JW.
JW.

Reputation: 4951

How to tell Eclipse to stop moving my curly brace backwards

I recently installed Eclipse (Helios Release) PDT and am trying to set the preferences to my project's style of code formatting.

I have gone into...

Eclipse PDT > Window > Preferences > PHP > Editor > Typing

...and unchecked all options.

I have also gone to:

Eclipse PDT > Window > Preferences > PHP > Editor > Templates

...and edited the 'Function Statement' template to look like this:

function ${function_name}() 
    {
    ${cursor};
    }

..and edited the 'class statement' template to look like this

class ${class_name}
    {
    function ${function_name}() 
            {
            ${cursor};
            }
    }

Now, back in the PHP editor, I am trying to write a method in the format like:

protected function testMethod()
    {
    return 'Hello'; 
    }   

In order to do this. First I write:

protected function testMethod()

Then, I hit return and the cursor lands under the 'p' or protected. Which is OK I spose:

protected function testMethod()
|

Then, I hit TAB and the cursor moves forward to where I'd like my opening curly brace to be (as expected):

protected function testMethod()
    |

-- The problem: --

Then, as soon as I type my curly brace, Eclipse moves it backwards to end up under the 'p':

protected function testMethod()
{

So, each time I type an opening curly brace I have to go back and move it forward again to where I wanted it:

protected function testMethod()
    {

Then I carry on.

Which part of Eclipse is responsible for this behaviour and how can I stop Eclipse from moving the curly brace backwards?

Any help would be appreciated.


Updates in response to suggestions:

I have gone into...

Eclipse PDT > Window > Preferences > PHP > Editor

and unchecked both:

Thanks for the suggestion Victor Nitu, but it did not fix the issue.

Upvotes: 1

Views: 682

Answers (1)

Victor Nițu
Victor Nițu

Reputation: 1515

I don't recall the UI & prefs back in the Helios, but as I can see in Indigo, I have the following setting:

PHP -> Editor: Smart caret positioning at line end (chackbox)

Let me know if it works.

LE: Confirmed as not working in Indigo either. I'll be back if I find something.

Upvotes: 2

Related Questions