简体   繁体   English

具有自定义类型的Eclipse Content Assist

[英]Eclipse Content Assist with custom types

The following example code behaves nicely with Content Assist: 以下示例代码在Content Assist中表现良好:

public void test(String a) {
    String b =
}

With the cursor placed after the = , Eclipse will suggest a at the top of the Content Assist. 将光标放在= ,Eclipse将在Content Assist的顶部建议a

The following will not behave nicely: 以下行为不会很好:

public void test(CustomType a) {
    CustomType b =
}

Instead of a being on top, instead CustomType will be on top, with a just below it. 而不是a顶部的存在,而不是CustomType将在顶部, a略低于它。 Why is this? 为什么是这样? It's driving me crazy. 这让我疯狂。 It clearly knows that a is relevant, so why suggest the class? 它清楚地知道a是相关的,那么为什么要建议班级呢? I can't assign a variable of type A to the class A . 我不能类型的变量分配A给类A

I can get around the suggestion by disabling Java Proposals (any of them) and enabling Java Non-Type Proposals in the Advanced settings of the Content Assist. 我可以通过禁用Java Proposals (它们中的任何一个)并在Content Assist的“高级”设置中启用Java Non-Type Proposals来解决该Java Non-Type Proposals However, this has the downside of disabling auto completion for types completely, which is even worse. 但是,这样做的缺点是完全禁用类型的自动完成功能,这甚至更糟。

I've noticed this problem in Luna, Mars, and Neon. 我已经在月神,火星和霓虹灯中注意到了这个问题。

Is it a bug? 是虫子吗? Is there a workaround for this? 有没有解决方法?

This looks to be a bug in Eclipse's JDT. 这似乎是Eclipse的JDT中的错误。

I have created an entry in their bugzilla. 我已经在他们的bugzilla中创建了一个条目

I don't think there is a workaround for this. 我认为没有解决方法。

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

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