简体   繁体   English

代码完成不适用于远程文件(使用 RSE)

[英]Code Completion not working with remote file (with RSE)

What is:什么是:

On Host machine:在主机上:
Windows 7 Eclipse for PHP Developers Windows 7 Eclipse 用于 PHP 开发人员
Version: Helios Service Release 2版本:Helios Service Release 2

On guest machine: Linux debian squeeze在客户机上: Linux debian 挤压

I want to edit my remote project through SSH in Eclipse by using RSE.我想使用 RSE 通过 Eclipse 中的 SSH 编辑我的远程项目。 All is okay, I do so in Remote System Explorer perspective:一切都好,我在远程系统资源管理器的角度这样做:

截图1

Then I go to PHP perspective.然后我从 go 到 PHP 透视。 Right click on project->Configure->Add PHP Support.右键单击项目->配置->添加 PHP 支持。 And press Ctrl+Shift+Space or Ctrl+Space .然后按Ctrl+Shift+SpaceCtrl+Space No completions (code assist) available.没有可用的完成(代码辅助)。

截图2

Okay I'm found this bug (at 2008) and solution description (at 2009): Bug 251496 .好的,我发现了这个错误(2008 年)和解决方案描述(2009 年):错误 251496 I did so:我这样做了:

Here's my solution to the problem: I just deleted the RemoteSystemsTempFiles project in the PHPExplorer View and than recreated it as a PHP Project (New->PHP Project, ofcourse it has to be named again RemoteSystemsTempFiles).这是我对问题的解决方案:我刚刚在 PHPExplorer 视图中删除了 RemoteSystemsTempFiles 项目,然后将其重新创建为 PHP 项目(新建-> PHP 项目,当然它必须再次命名为 RemoteSystemsTempFiles)。 This worked for me, now code completion is ok, hope this helps.这对我有用,现在代码完成没问题,希望这会有所帮助。

截图3

It does not solve the problem.它不能解决问题。 Because PHP Language library does not have Core API maybe... Help.因为 PHP 语言库没有核心 API 可能...帮助。 Thanks.谢谢。

Autocompletion for the PHP project (classes, functions...): PHP 项目的自动完成(类、函数...):

I found that adding the folowing lines to the.project did solve the autocompletion issue for the classes of the PHP project itself but did not work with native PHP functions:我发现将以下几行添加到 .project 确实解决了 PHP 项目本身的类的自动完成问题,但不适用于本机 PHP 函数:

<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>org.eclipse.php.core.PHPNature</nature>

I found a way around it:我找到了解决方法:

Autocompletion for the native PHP functions (print_r()...):原生 PHP 函数的自动完成(print_r()...):

You have to go to your eclipse configuration folder and find the PHP language folder:您必须将 go 到您的 eclipse 配置文件夹并找到 PHP 语言文件夹:

In my case: C:\Program Files\EclipseSF2\configuration\org.eclipse.osgi\bundles\276\1\.cp\Resources\language\php5.3在我的情况下: C:\Program Files\EclipseSF2\configuration\org.eclipse.osgi\bundles\276\1\.cp\Resources\language\php5.3

Then you can:那么你也能:

  • right click at the root of your eclipse project,右键单击 eclipse 项目的根目录,
  • then go to build path然后 go 构建路径
  • link source链接源
  • browse: and link to this folder...浏览:并链接到此文件夹...

This allows the autocompletion for native PHP function!这允许自动完成本机 PHP 功能!

Autocompletion for the Symfony framework: Symfony 框架的自动补全:

For people using the Symfony framework you can add to your.project file the following lines:对于使用 Symfony 框架的人,您可以在 your.project 文件中添加以下行:

<buildCommand>
        <name>com.dubture.symfony.core.symfonyBuilder</name>
        <arguments>
        </arguments>
</buildCommand>

When using RemoteSystemExplorer, there is a hidden project "RemoteSystemExplorer" in your workspace.使用 RemoteSystemExplorer 时,您的工作区中有一个隐藏项目“RemoteSystemExplorer”。

Close eclipse first.先关闭 eclipse。 I have edited the.project file there and added the line:我在那里编辑了 .project 文件并添加了以下行:

<nature>org.eclipse.php.core.PHPNature</nature>

within the Tag <natures>.在标签 <natures> 中。 And added the file.buildpath with the following content:并添加了具有以下内容的 file.buildpath:

<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
<buildpathentry kind="src" path=""/>
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
</buildpath>

Starting eclipse and php autocompletion is working.启动 eclipse 和 php 自动完成正在工作。 I have done this workflow with "eclipse Kepler".我已经用“eclipse Kepler”完成了这个工作流程。

Solution :解决方案

1) Close Eclipse . 1) 关闭Eclipse

2) Go to project path. 2) Go 到项目路径。

3) Open " .buildpath " with text editor (gedit, VIM, notepad, etc). 3) 使用文本编辑器(gedit、VIM、记事本等)打开“ .buildpath ”。

4) Add next line after " buildpath " line: 4) 在“ buildpath ”行之后添加下一行:

<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>

Example :示例

Before :之前

<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
    <buildpathentry kind="src" path="library"/>
    <buildpathentry kind="src" path="public"/>
    <buildpathentry kind="src" path="application"/>
</buildpath>

After :之后

<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
    <buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
    <buildpathentry kind="src" path="library"/>
    <buildpathentry kind="src" path="public"/>
    <buildpathentry kind="src" path="application"/>
</buildpath>

5) Save file and exit! 5) 保存文件并退出!

6) Open Eclipse. 6) 打开 Eclipse。

7) WORK! 7)工作!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM