4

In my project I have a series of *.tpl files that I would like Eclipse to interpret as PHP code. I have managed to get syntax highlighting to work properly for these files by adding a *.tpl entry in Preferences -> General -> Editors -> Content Types. However this does not seem to also enable syntax error checking / validation.

So to be clear, I would like Eclipse to show me per-line errors in the editor and also indicate any errors/warnings on the files in the PHP Explorer - for files with a .tpl extension. Currently neither is happening.

I have tried also adding *.tpl to Preferences -> General -> Editors -> File Associations. I have tried pressing F5 in various relevant places, and have tried restarting Eclipse. The folder with the *.tpl files is a subdirectory of a source folder. Other subdirectories of this source folder are working correctly (although they have .php files). I don't know what else to do. Please help!

Thanks!

Mihai Iorga
  • 39,330
  • 16
  • 106
  • 107
Pryo
  • 690
  • 1
  • 10
  • 24

2 Answers2

3

For what it's worth, I tried creating a custom *.guvava and was able to do so by adding *.guvava to Content Types and File Associations. When I opened up a new guvava file after that, I had everything I would have in a java file.

enter image description here

enter image description here

enter image description here

Ashutosh Jindal
  • 18,501
  • 4
  • 62
  • 91
1

Well that's bizarre. I just tried to test Ashutosh's example and it worked. After creating a new file test.tpl, all of a sudden all other .tpl files in the project started being parsed/validated properly and all the warning/error icons suddenly appeared.

So this seems like a bug in this version of Eclipse (http://www.zend.com/en/community/pdt/downloads). Hopefully this is a repeatable workaround for anyone else who experiences the problem though!

Thanks very much guys.

Pryo
  • 690
  • 1
  • 10
  • 24
  • I suggest [posting a detailed bug report](https://bugs.eclipse.org/bugs/) of this while the incident is still fresh. I had a similar problem in the past, but I neglected to report it. (IIRC, it fixed itself when I closed all the open editors of the files that weren't being treated as PHP and then re-opened the workspace.) ([Eclipse bug-reporting FAQ](http://wiki.eclipse.org/FAQ_How_do_I_report_a_bug_in_Eclipse%3F)) – Lèse majesté Aug 20 '12 at 13:58
  • I have just tried to repeat this from scratch so as to produce such a report, but I'm incredibly frustrated to find it will not work a second time around. I am back to square one! :/ – Pryo Aug 20 '12 at 14:31
  • No worries, same thing happened to me. =P It's not a huge problem, and if anyone else encounters it, they should be able to solve it with the help of this page. – Lèse majesté Aug 20 '12 at 14:33
  • Yeah agreed. I hope it's not too long till I re-stumble across whatever combination of prods gets it to work! :p – Pryo Aug 20 '12 at 14:38
  • 1
    I have gone from scratch 3 times and have carefully tried to identify what combination of events gets the validation process to start for the .tpl files. Unfortunately the best I can say is that it seems to need a certain amount of time until it "just works". In my case, about 15 minutes. During that time I added *.tpl to the Content Types page and then did various things such as creating .tpl files and/or using Project > Clean... a number of times. I'll update this if I can clarify any of this further. – Pryo Aug 21 '12 at 15:59