如何在 Eclipse 中指定空白样式并重新格式化有问题的文档?

发布于 2024-12-17 04:39:00 字数 539 浏览 3 评论 0原文

我有一个混合了 HTML、JavaScript 和 PHP 的文档。我在 Eclipse 中编辑它。

我不是该文档的原作者,我正在修改它。

修改时,Eclipse的TAB和SHIFT+TAB(缩进和取消缩进)无法按预期工作。

通过按 TAB 键插入的任何缩进都可以使用 SHIFT+TAB 撤消,但文档中已有的缩进无法以相同的方式撤消。在这种情况下按 SHIFT+TAB 不会执行任何操作。

该文件中的空格似乎与 Eclipse 期望的不同。

我的自然编码风格(来自自定义 VIM)是仅包含空格,我的 TAB 和 SHIFT+TAB 一次插入和删除四个空格。

如何为此重新编程 Eclipse,然后让 Eclipse 重新设计该未知格式的文档,以将键盘快捷键恢复为正常行为?

我明白 [窗口] -> [偏好设置]-> (语言)-> [代码风格] 包含很多选项,但这超出了我现在想要做的,而且我通常发现自己在很多不同的 Eclipse 安装中工作。我可以在某个地方找到针对此特定样式和导入的预定义代码样式吗?我想这是一种相对常见的风格。

I have a document that is mixed HTML, JavaScript, and PHP. I edit it in Eclipse.

I am not the original author of the document, I am modifying it.

When modifying it, Eclipse's TAB and SHIFT+TAB (Indent and Unindent) do not function as expected.

Any indentation I insert by pressing TAB can be undone with SHIFT+TAB, but the indentation already in the document cannot be undone the same way. Pressing SHIFT+TAB in this case does nothing.

It seems the whitespacing in this file is different than what Eclipse expects.

My natural coding style (which came from customizing VIM) is spaces-only, with my TAB and SHIFT+TAB inserting and removing four spaces at a time.

How do I reprogram Eclipse for this, and then get Eclipse to restyle this document of unknown formatting to restore my keyboard shortcuts to normal behavior?

I understand that [Window] -> [Preferences] -> (language) -> [Code Style] contains a lot of options, but that's more than I was looking to do right now, plus I commonly find myself working in a lot of different Eclipse installations. Are there predefined Code Styles I can find somewhere for this particular style and import? I would imagine it is a relatively common style.

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

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

发布评论

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

评论(1

纸短情长 2024-12-24 04:39:00

据我所知,没有办法不导入一组特定的首选项,这似乎是您正在寻找的。您将它们作为一个整体导入和导出(顺便说一下,它的工作效果不是很好)。

恐怕您要做的就是在首选项中自行配置它们,并或多或少地手动编辑代码。

As far as I know there is no way no import a particular set of preferences, which seems what you are looking for. You import and export them as a whole (and it doesn't work very well, by the way).

I am afraid what you have to do is to configure them yourself in the preferences and edit the code more or less manually.

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