Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse syntax highlighting: trying to specify it for a new file extension, and it's not working

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.

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?).

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.

like image 779
xgretsch Avatar asked Apr 02 '11 16:04

xgretsch


People also ask

Does Eclipse have syntax highlighting?

The color and font settings can be configured from the Syntax Coloring preferences page, accessed from Window | Preferences | PHP | Editor | Syntax Coloring. Note: Syntax Coloring will also be available for JavaScript elements if JavaScript support was enabled for the project.

How do I turn off syntax highlighting in Eclipse?

Select Window->Preferences->C/C++->Scalability->Disable syntax coloring in editor.

Why JS file is not working in Eclipse?

It's possible that you are developing in a different perspective that does not have this association preset. It should be noted, if it was already opened in normal eclipse editor, you need to close and reopen file for that to take effect. (The JS editor as default should be set automatically.)


1 Answers

You only have to enable it from here

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

and do a restart.

like image 81
johnlemon Avatar answered Sep 27 '22 15:09

johnlemon