Fulltext autocompletion proposal [message #670705] |
Sun, 15 May 2011 07:43  |
Eclipse User |
|
|
|
Hello Recommenders Team!
I've learned about your project via StackOverflow topic. Unfortunatelly I can not paste link here, because of forum rules (need to post at least 5 msgs :/). If you're interested in checking it type this in search bar on stackoverflow.com: "Eclipse: Fulltext autocompletion for Java?".
I'd like to make a proposal about fulltext autocompletion.
Figure: Simple Java Bean class
class Person {
String name, surname, dataXml, dataSql;
+ getters and setters for fields
+ default constructor
}
Now pressing "g" completes all geters to me. This is fine as long as my class is small enough to list them quickly. But imagine you have much more fields.
Now see I put there field "dataXml" which has corresponding getter "getDataXml()". After some time you want to use this bean, but you don't remember exact field name, you only know that there was something with xml in name. Typing xml would automatically propose "getDataXml()" method. Same applies with "Sql" and so on.
I hope I made my proposal clear enough, or please take a look at stackoverflow topic for more info.
Thanks!
|
|
|
|
|
|
|
|
|
|
|
|
Re: Fulltext autocompletion proposal [message #671088 is a reply to message #671049] |
Mon, 16 May 2011 14:12   |
Eclipse User |
|
|
|
I just made the completion engine available on the HEAD update site. I dubbed it the "naive subwords completion engine" - please come up with a better name if you have one.
Just a few words on the implementation. It's a very simple one that helps you on completing method names only - it does not compute proposals for types, variable names etc. yet. There is no particular reason for this but I haven't found a perfect place to make this code work for every kind of completion yet. Also it's an untested monday afternoon hack...
To install this completion engine just add
http://download.eclipse.org/recommenders/updates/head/
to your list of update sites and install the
Code Recommenders: Naive Subwords Completion (Incubator)
from Sandbox category as depicted below.

You may configure where/when Eclipse makes these proposals. Study the screenshot below for details.

In a nutshell, it takes your prefix entered and creates a regular expression from it. For example, when entering button.stx|<^Space&> the engine only presents those proposals that match this regular expression .*s.*t.*x.* which finally may match "setText(text)". This is roughly what Maxime proposed in his comment below. Currently, it does not reduce the proposal score as recommended by another comment - but we may do that if you find this more useful. Just drop a comment below...
Please note, this is a quick shot to understand your requirements. Please
- send all your comments (positive and negative) to this forum,
- inform us about issues with the current implementation,
- if you want it to change in some way - tell us about it, and finally
- for the adventurous: the source is free (EPL) and contains just 2 small classes + a plugin.xml declaring a standard IJavaCompletionProposalComputer. Feel invited to checkout the subwords feature from repository and improve it. It has no dependencies to Code Recommenders. Thus it should work standalone from inside your IDE and should be very easy to extend. We'll be glad to support you on your extensions - and it won't get easier to contribute to an open source project than now

The sources are available in git here: http://goo.gl/V9q14
The commit log is here: http://goo.gl/gLV9r
[Updated on: Mon, 16 May 2011 16:18] by Moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06235 seconds