开发者

How to tell PHPEclipse to use spaces instead of tabs

I just switched back from PDT to PHPEclipse (Because PDT is too unstable for my taste) but now I have the problem that I can't find out how to tell PHPEclipse to indent PHP code with spaces instead of tabs. I have enabled the usage of spaces in the following preference locations:

PHPEclipse/PHP/Formatter/ (Unch开发者_JS百科ecked "Indentation is represented by a tab")
General/Editors/Text Editors/ (Checked "Insert spaces for tabs")

*.php Files are only associated with the PHPEclipse editor and the standard text editor. The PHPEclipse preferences page says "Some general preferences now live on the Text Editors pages" so it sounds like PHPEclipse should use the general text editor preferences. But it just doesn't work. PHPEclipse always uses tabs instead of spaces.

Any hints how I can get it to use spaces?


just added PHPEclipse to my Eclipse, seems that the following should help you:

Window > Preferences > PHPEclipse > PHP > Typing*

"Typing" is name of tab. There is setting "Insert spaces for tab (see Code Formatter preference page", check it and you will get spaces instead of tabs ;)


I tried ok for eclipse-php 3.0.2:

1. go to "window > preferences > code style > formatter ";
2. change tab policy from "tabs" to "spaces"; 
3. change indentation size as you need;
4. Apply - ok.


The following worked for me (PHP Symfony also installed).

My version of Eclipse: Eclipse SDK 4.2.2

Installed

  • PHP editor: PHP Development Tools (PDT) 3.1.
  • Symfony Feature: 1.0.85

Instructions

  1. go to "Window > preferences > PHP > Code Style > Formatter (PDT Tools)
  2. Switch the "Active profile" from Eclipse [built-in] to Symfony [built-in]

The Eclipse built-in profile had tab indents in the preview; whereas the Symfony built-in profile has 4 spaces for each indent.


I'm using eclipse 3.8.1. Following worked for me:

Windows > PHP > Code Style > Formatter
Set "Tab policy:" to "Spaces
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜