Eclipse 语法突出显示:尝试为新文件扩展名指定它,但它不起作用

2022-01-23 00:00:00 syntax-highlighting php drupal-7 eclipse

我正在使用 Eclipse/PHP,刚开始使用 Drupal 7,这需要我使用扩展名为 .test 的 PHP 文件.所以我正在尝试将.test"扩展名添加到 Eclipse 识别为 PHP 的文件列表中.

I'm working with Eclipse/PHP and just starting with Drupal 7, which needs me to use PHP files of extension .test. So I'm trying to add the ".test" extension to the list of files that Eclipse recognises as PHP.

我有两种方法:(1)通过在 Preferences-General-Editors-File Associations 中指定它,以及(2)通过在 Preferences-General-Content Types 中指定.test"(如 如何手动指定特定扩展的语法高亮在 Eclipse 中?).

I've done this two ways: (1) By specifying it in Preferences-General-Editors-File Associations, and (2) By specifying ".test" in Preferences-General-Content Types (as described in How to manually specify syntax highlighting for a specific extension in Eclipse?).

问题是,什么也没有发生——我的 xyz.test 文件在 PHP 编辑器中打开得很好,但没有突出显示语法(是的,文件确实以 <?php 开头).一个明显相同的技术适用于.module"扩展名,但我很久以前就这样做了,我不确定我可能做了什么不同的事情.

The trouble is, nothing happens - my xyz.test file opens just fine with the PHP editor, but no syntax is highlighted (and yes, the file does start with <?php). An apparently identical technique works fine for the ".module" extension, but I did this a long time ago and I'm not sure what I may have done differently.

任何想法表示赞赏.我可能忘记了一些愚蠢的事情.

Any ideas appreciated. I've probably forgotten something stupid.

推荐答案

你只需要从这里启用它

 Window > Preferences > General > Content Types > Text > PHP Content Type

然后重新启动.

相关文章