0

嗨,我有兴趣了解 eclipse 自动完成功能的工作原理。我想了解eclipse如何区分一段Java代码中的局部变量和全局变量。我还想了解 eclipse 如何为无限数量的类存储方法签名,以及它如何将方法与给定的类相关联。一个人是否有可能为 JavaScript 这样的语言开发自动完成功能。

4

1 回答 1

1

There is already an AutoComplete feature for Javascript. You just need to let Eclipse install the appropriate extensions.

Eclipse maintains a model of your program, including the project and all the dependencies. It's big, but it's not infinite. When you hit the dot, it figures out based on the variable type what the target type can be, and then displays the relevant methods based on its internal model.

This is easy for Java because you can usually know the static type. Much harder in other languages.

The Eclipse plug-in developer's guide discusses how different things, including the internal model and auto completion works. There are extension points to implement yiur own.

于 2013-10-04T05:08:54.200 回答