2

我刚刚从 PDT 切换回 PHPEclipse(因为 PDT 对我的口味来说太不稳定了),但现在我遇到的问题是我不知道如何告诉 PHPEclipse 用空格而不是制表符缩进 PHP 代码。我已在以下首选项位置启用空间的使用:

PHPEclipse/PHP/Formatter/ (Unchecked "Indentation is represented by a tab")
General/Editors/Text Editors/ (Checked "Insert spaces for tabs")

*.php 文件仅与 PHPEclipse 编辑器和标准文本编辑器相关联。PHPEclipse 首选项页面显示“一些常规首选项现在存在于文本编辑器页面上”,因此听起来 PHPEclipse 应该使用常规文本编辑器首选项。但它只是行不通。PHPEclipse 总是使用制表符而不是空格。

任何提示我如何让它使用空格?

4

4 回答 4

7

刚刚将 PHPEclipse 添加到我的 Eclipse 中,似乎以下内容应该对您有所帮助:

Window > Preferences > PHPEclipse > PHP > Typing*

“打字”是选项卡的名称。有设置“为选项卡插入空格(参见代码格式化程序首选项页面”,检查它,你会得到空格而不是制表符;)

于 2011-02-19T19:44:11.407 回答
2

我为 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.
于 2013-05-29T06:02:10.957 回答
1

以下对我有用(还安装了 PHP Symfony)。

我的 Eclipse 版本:Eclipse SDK 4.2.2

已安装

  • PHP 编辑器:PHP 开发工具 (PDT) 3.1。
  • Symfony 功能:1.0.85

指示

  1. 转到“窗口 > 首选项 > PHP > 代码样式 > 格式化程序(PDT 工具)
  2. 将“活动配置文件”从 Eclipse [内置] 切换到 Symfony [内置]

Eclipse 内置配置文件在预览中有制表符缩进;而 Symfony 内置配置文件的每个缩进有 4 个空格。

于 2013-05-31T19:23:06.210 回答
1

我正在使用 Eclipse 3.8.1。以下为我工作:

Windows > PHP > Code Style > Formatter
Set "Tab policy:" to "Spaces
于 2014-07-01T20:03:46.567 回答