Eclipse自动完成功能不适用于PHP项目

时间:2023-01-17 20:59:02

My Eclipse doesn't use auto-complete... My colleague get a whole list of suggestions by just typing some letters and I get nothing...

我的Eclipse不使用自动完成...我的同事只需键入一些字母就可以得到一整套建议而且我什么都没得到......

The Eclipse version I use is:

我使用的Eclipse版本是:

Eclipse for PHP Developers

Version: Helios Service Release 2
Build id: 20110301-1815

(c) Copyright Eclipse contributors and others 2000, 2011.  All rights reserved.
Visit http://eclipse.org/ 

And I think I've set all available settings for autocomplete.
I lose a huge amount of time every time I have to search for the correct naming. Is there any module of software I've to install extra to get this autocompletion?

我想我已经为自动完成设置了所有可用的设置。每次我必须搜索正确的命名时,我会失去大量的时间。是否有任何软件模块我需要额外安装以获得此自动完成功能?

7 个解决方案

#1


21  

Ok, found the solution! Apparently I had to "Add PHP support" in the properties window of the project. Thanks for all the help though!

好的,找到了解决方案!显然,我必须在项目的属性窗口中“添加PHP支持”。感谢所有的帮助!

Eclipse自动完成功能不适用于PHP项目

#2


10  

I did it by deleting ".metadata" directory on my main workspace :D

我是通过删除主工作区上的“.metadata”目录来完成的:D

#3


8  

Generally this can be activated by enabling Content Assist. It can be found on Window-Preference->PHP->Editor->Content Assist

通常,可以通过启用内容辅助来激活此功能。它可以在Window-Preference-> PHP-> Editor-> Content Assist中找到

  1. Setup your php_include_path. Go to the properties of the project. Then PHP Include Path.
  2. 设置你的php_include_path。转到项目的属性。然后PHP包含路径。

  3. If you have any external library add it there too (I use Zend and Kohana).
  4. 如果你有任何外部库也添加它(我使用Zend和Kohana)。

#4


2  

Check the options in Windows preferences for content assist. It might be disabled. It probably would be php -> Editor -> Content Assist and see what is selected for auto activation.

检查Windows首选项中的选项以获取内容辅助。它可能被禁用。它可能是php - > Editor - > Content Assist,看看为自动激活选择了什么。

#5


2  

I can try ALL answers (from this and others threads), only work for me delete (or rename for backup) .metadata folder on workspace folder

我可以尝试所有答案(来自这个和其他线程),只为我工作删除(或重命名备份)工作区文件夹上的.metadata文件夹

  1. Close eclipse
  2. mv .metadata .metadata_older
  3. mv .metadata .metadata_older

  4. Start eclipse (clean start wrokspace of eclipse, none project are listed)
  5. 启动eclipse(清除启动eclipse的wrokspace,没有项目列出)

  6. Import from workspace your project
  7. 从工作区导入项目

  8. Eclipse rebuild and refresh works (several project settings are lost!!!)
  9. Eclipse重建和刷新工作(丢失了几个项目设置!!!)

  10. Autocompletion, follow code, etc now work.
  11. 自动完成,遵循代码等现在工作。

This isn't the ideal solution, but is the ONLY solution for me, I migrated from eclipse 3.6 to 4.4 in one step, and PHP support is gone, only highlight code are working until delete .metadata folder.

这不是理想的解决方案,但对我来说是唯一的解决方案,我一步从eclipse 3.6迁移到4.4,并且PHP支持消失了,只有突出显示代码才能删除.metadata文件夹。

Ubuntu 12.04 LTS 64 Java 1.7 ORACLE

Ubuntu 12.04 LTS 64 Java 1.7 ORACLE

Thanks.

#6


0  

I don't use Eclipse, but I know in Netbeans (and other IDE's) you can type Ctrl + Space to bring up the auto complete window after you start typing a function/variable.

我不使用Eclipse,但我知道在Netbeans(和其他IDE)中,您可以在键入函数/变量后键入Ctrl + Space以显示自动完成窗口。

Give that a try.

试一试。

#7


0  

If this happens only for one project in Eclipse and others are autocompleting correctly, it sometimes happen when you create new PHP project and press Finish on the first page.

如果这只发生在Eclipse中的一个项目中,而其他项目正确地自动完成,则有时会在创建新的PHP项目并在第一页上按Finish时发生。

To fix it, remove the project from Eclipse (Windows > Show view > Navigator and press DELETE on the project). Then go to project folder and delete file .project and folder .setting.

要修复它,请从Eclipse中删除项目(Windows>显示视图>导航器,然后按项目上的DELETE)。然后转到项目文件夹并删除文件.project和文件夹.setting。

In Eclipse now select File > New > PHP project, select name and folder, press Next and verify (or manually add) that root folder of the project is listen on Source tab.

在Eclipse中现在选择File> New> PHP project,选择name和folder,按Next并验证(或手动添加)项目的根文件夹是在Source选项卡上侦听。

Then click Next and add root folder of the project or folders that contain PHP files into Build path. Now you can click Finish.

然后单击“下一步”,将包含PHP文件的项目或文件夹的根文件夹添加到“构建路径”中。现在您可以单击“完成”。

Note: adding Source and Build paths into existing project usually does not fix this problem and you really have to delete and create new project.

注意:将Source和Build路径添加到现有项目中通常无法解决此问题,您必须删除并创建新项目。

#1


21  

Ok, found the solution! Apparently I had to "Add PHP support" in the properties window of the project. Thanks for all the help though!

好的,找到了解决方案!显然,我必须在项目的属性窗口中“添加PHP支持”。感谢所有的帮助!

Eclipse自动完成功能不适用于PHP项目

#2


10  

I did it by deleting ".metadata" directory on my main workspace :D

我是通过删除主工作区上的“.metadata”目录来完成的:D

#3


8  

Generally this can be activated by enabling Content Assist. It can be found on Window-Preference->PHP->Editor->Content Assist

通常,可以通过启用内容辅助来激活此功能。它可以在Window-Preference-> PHP-> Editor-> Content Assist中找到

  1. Setup your php_include_path. Go to the properties of the project. Then PHP Include Path.
  2. 设置你的php_include_path。转到项目的属性。然后PHP包含路径。

  3. If you have any external library add it there too (I use Zend and Kohana).
  4. 如果你有任何外部库也添加它(我使用Zend和Kohana)。

#4


2  

Check the options in Windows preferences for content assist. It might be disabled. It probably would be php -> Editor -> Content Assist and see what is selected for auto activation.

检查Windows首选项中的选项以获取内容辅助。它可能被禁用。它可能是php - > Editor - > Content Assist,看看为自动激活选择了什么。

#5


2  

I can try ALL answers (from this and others threads), only work for me delete (or rename for backup) .metadata folder on workspace folder

我可以尝试所有答案(来自这个和其他线程),只为我工作删除(或重命名备份)工作区文件夹上的.metadata文件夹

  1. Close eclipse
  2. mv .metadata .metadata_older
  3. mv .metadata .metadata_older

  4. Start eclipse (clean start wrokspace of eclipse, none project are listed)
  5. 启动eclipse(清除启动eclipse的wrokspace,没有项目列出)

  6. Import from workspace your project
  7. 从工作区导入项目

  8. Eclipse rebuild and refresh works (several project settings are lost!!!)
  9. Eclipse重建和刷新工作(丢失了几个项目设置!!!)

  10. Autocompletion, follow code, etc now work.
  11. 自动完成,遵循代码等现在工作。

This isn't the ideal solution, but is the ONLY solution for me, I migrated from eclipse 3.6 to 4.4 in one step, and PHP support is gone, only highlight code are working until delete .metadata folder.

这不是理想的解决方案,但对我来说是唯一的解决方案,我一步从eclipse 3.6迁移到4.4,并且PHP支持消失了,只有突出显示代码才能删除.metadata文件夹。

Ubuntu 12.04 LTS 64 Java 1.7 ORACLE

Ubuntu 12.04 LTS 64 Java 1.7 ORACLE

Thanks.

#6


0  

I don't use Eclipse, but I know in Netbeans (and other IDE's) you can type Ctrl + Space to bring up the auto complete window after you start typing a function/variable.

我不使用Eclipse,但我知道在Netbeans(和其他IDE)中,您可以在键入函数/变量后键入Ctrl + Space以显示自动完成窗口。

Give that a try.

试一试。

#7


0  

If this happens only for one project in Eclipse and others are autocompleting correctly, it sometimes happen when you create new PHP project and press Finish on the first page.

如果这只发生在Eclipse中的一个项目中,而其他项目正确地自动完成,则有时会在创建新的PHP项目并在第一页上按Finish时发生。

To fix it, remove the project from Eclipse (Windows > Show view > Navigator and press DELETE on the project). Then go to project folder and delete file .project and folder .setting.

要修复它,请从Eclipse中删除项目(Windows>显示视图>导航器,然后按项目上的DELETE)。然后转到项目文件夹并删除文件.project和文件夹.setting。

In Eclipse now select File > New > PHP project, select name and folder, press Next and verify (or manually add) that root folder of the project is listen on Source tab.

在Eclipse中现在选择File> New> PHP project,选择name和folder,按Next并验证(或手动添加)项目的根文件夹是在Source选项卡上侦听。

Then click Next and add root folder of the project or folders that contain PHP files into Build path. Now you can click Finish.

然后单击“下一步”,将包含PHP文件的项目或文件夹的根文件夹添加到“构建路径”中。现在您可以单击“完成”。

Note: adding Source and Build paths into existing project usually does not fix this problem and you really have to delete and create new project.

注意:将Source和Build路径添加到现有项目中通常无法解决此问题,您必须删除并创建新项目。