Force Content-Type on files with no Extension in EclipsePDT?

て烟熏妆下的殇ゞ 提交于 2020-01-11 09:55:19

问题


I use Eclipse-PDT to work on my PHP projects and find it inconvenient when Eclipse does not recognize my php files that have no extension. Our project contains many cli/bash-style php scripts that have no file-extension (for whatever reason). This results in no code-completion, highlighting, etc for these particular files. It treats them as plain-text.

Is there a way I can mark these particular files as PHP to use the PDT features?


回答1:


If I remember correctly, you might be able to do something like this :

  • right-click on the file in the Navigator panel -- or the equivalent you are using
  • choose Open with > Other...
  • In the dialog box that pops-up, you should be able to choose the PHP Editor

Next time you'll double-click on that file to open it, it should automatically bge opened using the editor you selected earlier.

But you'll have to do that once for each one of your files, so Eclipse PDT does know for which files which editor it should use...




回答2:


A workaround suggested by Swooper (in his case for perl) here suggests to create links to the files with extensions and edit the files in Eclipse through those links.

Not ideal and maybe hard if you have a lot of extensionless files, but it will work.



来源:https://stackoverflow.com/questions/2009636/force-content-type-on-files-with-no-extension-in-eclipsepdt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!