Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » Why do i get tabs instead of 4 spaces when auto indention takes place on hitting ENTER?
Why do i get tabs instead of 4 spaces when auto indention takes place on hitting ENTER? [message #511681] Tue, 02 February 2010 14:03 Go to next message
Daniela Waranie is currently offline Daniela Waranie
Messages: 52
Registered: July 2009
Member
Hi all,

i configured my Eclipse to use 4 spaces for indention (instead of a tab).

When i hit "TAB" in the php editor of PDT i get 4 spaces. Ok, good.
But.
When i hit "ENTER" i get tabs instead of 4 spaces, but why?

Is that a bug or how do i need to configure my eclipse/PDT to work well?

Best regards
Daniela Waranie
Re: Why do i get tabs instead of 4 spaces when auto indention takes place on hitting ENTER? [message #511863 is a reply to message #511681] Wed, 03 February 2010 09:43 Go to previous messageGo to next message
Daniela Waranie is currently offline Daniela Waranie
Messages: 52
Registered: July 2009
Member
Hi all,

to illustrate my problem you can find a code example on:
http://pastie.org/807270

Please confirm the bug or help me please.

Best regards
Daniela Waranie
Re: Why do i get tabs instead of 4 spaces when auto indention takes place on hitting ENTER? [message #511874 is a reply to message #511681] Wed, 03 February 2010 05:14 Go to previous messageGo to next message
Daniela Waranie is currently offline Daniela Waranie
Messages: 52
Registered: July 2009
Member
Hi all,

another example (but about replacing tab whitespaces):
http://pastie.org/807288

Can you confirm this bug or is it a misconfiguration?

Best regards
Daniela Waranie
Re: Why do i get tabs instead of 4 spaces when auto indention takes place on hitting ENTER? [message #511899 is a reply to message #511874] Wed, 03 February 2010 10:55 Go to previous messageGo to next message
Eclipse User
Originally posted by: christian.wolf.sedo.de

Hi Daniela,

I tried to reproduce that behaviour and found a way:
if I simply set the "Window > Preferences > General > Editors > Text
Editors > Insert spaces for tabs" option, I get the exact behaviour you
described.

However, if I wanted to switch from tab to space indentation, I first
navigated to "Window > Preferences > PHP > Code Style > Formatter",
setting "Tab policy" and "Indentation size" accordingly. After setting
these options, hitting both "tab" and "enter" insert spaces instead of
tabs in every situation.

Perhaps this configuration helps you, too,

best
Christian A. Wolf


Daniela Waranie schrieb:
> Hi all,
>
> another example (but about replacing tab whitespaces):
> http://pastie.org/807288
>
> Can you confirm this bug or is it a misconfiguration?
>
> Best regards
> Daniela Waranie
Re: Why do i get tabs instead of 4 spaces when auto indention takes place on hitting ENTER? [message #512001 is a reply to message #511899] Wed, 03 February 2010 10:58 Go to previous messageGo to next message
Daniela Waranie is currently offline Daniela Waranie
Messages: 52
Registered: July 2009
Member
Hi Christian,

your tip is good, but sadly not perfect...

It works for my example (tabs are now replaced in that case):
http://pastie.org/807288
And it works for my first example:
http://pastie.org/807270

But that works when only a tab whitespace is marked/selected. When
selecting more than a whitespace no replacement takes place.
See this for details on the behavior:
http://pastie.org/807654

It seems that "auto indentation" copies the indentation characters from
the line above (which may contain tab whitespaces). This means "auto
indentation" is not respecting the settings (!).
See this for details:
http://pastie.org/807683

my settings:
1) "Window > Preferences > General > Editors > Text Editors > Insert
spaces for tabs"
2) "Window > Preferences > General > Editors > Text Editors > Display
tab width = 4"
3) "Window > Preferences > PHP > Code Style > Formatter >Tab policy =
Spaces"
4) "Window > Preferences > PHP > Code Style > Formatter >Indentation
size = 4"

Can any one confirm this bug.
Or is this a misconfiguration?

Best regards
Daniela Waranie
icon10.gif  Re: Why do i get tabs instead of 4 spaces when auto indention takes place on hitting ENTER? [message #652639 is a reply to message #511681] Fri, 04 February 2011 19:34 Go to previous messageGo to next message
Jason F. Grissom is currently offline Jason F. Grissom
Messages: 1
Registered: February 2011
Location: San Diego
Junior Member
From what I am seeing here:

It doesn't look like a bug... it looks like its by design... at least it seems like good design to me... Very Happy

There is a "tab policy" setting for each language you're writing in...

So:
1) General->Editors->Text Editors (has a tab policy that you'll use when you're writing in PHP)

2) JavaScript-> Code Style -> Formatter (requires you to create a new "Profile" for JavaScript then modify the indentation properties, or change an existing one... but who modifies defaults these days?)

3) Web -> CSS Files -> Editor (Has a radio button for tabs or spaces. You can set the indentation size too.)

4) Web -> HTML Files -> Editor (Has the same radio buttons and indentation size property as CSS.)
Re: Why do i get tabs instead of 4 spaces when auto indention takes place on hitting ENTER? [message #660664 is a reply to message #511681] Sun, 20 March 2011 21:21 Go to previous messageGo to next message
PS Craig is currently offline PS Craig
Messages: 5
Registered: March 2011
Junior Member
Hi Guys,

Did anyone find a resolution to this problem? I have the exact same problem.
Re: Why do i get tabs instead of 4 spaces when auto indention takes place on hitting ENTER? [message #663091 is a reply to message #511681] Sun, 03 April 2011 14:13 Go to previous message
Miha Vrhovnik is currently offline Miha Vrhovnik
Messages: 9
Registered: July 2009
Junior Member
Also there is a bug report.

However I don't give a damn about a PDT anymore. I have switched to the PHPStorm and I'm happy with it.
Previous Topic:Errors when trying to open a php file.
Next Topic:Unsupported Content Type
Goto Forum:
  


Current Time: Thu Oct 23 08:47:16 GMT 2014

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

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