如何告诉 PHPEclipse 使用空格而不是制表符

发布于 2024-10-18 02:49:25 字数 459 浏览 4 评论 0原文

我刚刚从 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 始终使用制表符而不是空格。

有什么提示可以让它使用空格吗?

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/ (Unchecked "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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

半边脸i 2024-10-25 02:49:25

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

Window > Preferences > PHPEclipse > PHP > Typing*

“键入”是选项卡的名称。有设置“为制表符插入空格(请参阅代码格式化程序首选项页面”,选中它,您将得到空格而不是制表符;)

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 ;)

网名女生简单气质 2024-10-25 02:49:25

我尝试了 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.

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.
一袭白衣梦中忆 2024-10-25 02:49:25

以下内容对我有用(也安装了 PHP Symfony)。

我的Eclipse版本:Eclipse SDK 4.2.2

安装的

  • PHP编辑器:PHP Development Tools (PDT) 3.1。
  • Symfony 功能:1.0.85

说明

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

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

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.

坐在坟头思考人生 2024-10-25 02:49:25

我正在使用 Eclipse 3.8.1。
以下对我有用:

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

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

Windows > PHP > Code Style > Formatter
Set "Tab policy:" to "Spaces
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文