Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Code Recommenders » Fulltext autocompletion proposal(Can I has this?)
Fulltext autocompletion proposal [message #670705] Sun, 15 May 2011 11:43 Go to next message
No real name is currently offline No real nameFriend
Messages: 4
Registered: May 2011
Junior Member
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 #670768 is a reply to message #670705] Sun, 15 May 2011 12:44 Go to previous messageGo to next message
Marcel Bruch is currently offline Marcel BruchFriend
Messages: 49
Registered: July 2009
Member
You mean something like this?

You enter 'cod' and completion engine returns 'hashCode' as depicted?

Best,
Marcel
Re: Fulltext autocompletion proposal [message #670771 is a reply to message #670768] Sun, 15 May 2011 13:00 Go to previous messageGo to next message
Marcel Bruch is currently offline Marcel BruchFriend
Messages: 49
Registered: July 2009
Member
Maybe another (bit more clear) example.
Re: Fulltext autocompletion proposal [message #670773 is a reply to message #670771] Sun, 15 May 2011 13:17 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 4
Registered: May 2011
Junior Member
exactly!
Re: Fulltext autocompletion proposal [message #670776 is a reply to message #670773] Sun, 15 May 2011 13:40 Go to previous messageGo to next message
Marcel Bruch is currently offline Marcel BruchFriend
Messages: 230
Registered: July 2009
Senior Member
Well, then a first prototype its implemented. Let me see where to put it.

Anyone else interested in such a completion engine?


tw: @MarcelBruch
tw: @Recommenders

[Updated on: Sun, 15 May 2011 13:41]

Report message to a moderator

Re: Fulltext autocompletion proposal [message #670779 is a reply to message #670776] Sun, 15 May 2011 13:53 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 4
Registered: May 2011
Junior Member
Brilliant, I am sure there will be many others. Please keep us updated about this feature, how to get it and so on Smile
Re: Fulltext autocompletion proposal [message #670836 is a reply to message #670705] Sun, 15 May 2011 19:48 Go to previous messageGo to next message
Gary Fritz is currently offline Gary FritzFriend
Messages: 1
Registered: May 2011
Junior Member
When coding GUI stuff, I sometimes could not remember the exact name of specific functions, i.e. for focusing (it's "requestFocus()" and not "setFocus()") and there are many results in Google where people look for exactly this question. What I'm trying to say is that remembering setters and getters is easy. But when it comes to specific, API-related stuff like constants or enum items, this feature would indeed be cool. I'd vote it 20% useful, so it would be worth an option in some properties dialogue.
Re: Fulltext autocompletion proposal [message #670903 is a reply to message #670836] Mon, 16 May 2011 06:53 Go to previous messageGo to next message
Sascha Vogt is currently offline Sascha VogtFriend
Messages: 16
Registered: March 2011
Junior Member
+1 for this, as I find it quite useful.
In a lot of legacy code one can find constant class / interfaces which have dozens of constants separated by namespaces like LABEL_TEXT_OK, LABEL_TEXT_CANCEL, etc. In such cases if you need them a lot, only typing cancel or ok to get to them would be quite helpful.
Re: Fulltext autocompletion proposal [message #670925 is a reply to message #670903] Mon, 16 May 2011 08:40 Go to previous messageGo to next message
Marcel Bruch is currently offline Marcel BruchFriend
Messages: 230
Registered: July 2009
Senior Member
Just to merge this thread with the blog post I wrote yesterday (see http://code-recommenders.blogspot.com/2011/05/subword-matchi ng-completion-engine-for.html). Lars and Maxime have posted that they would like to have such kind of completion engine too. I found a paper on (almost) exactly this topic. Could you check out these screencasts?

* http://vimeo.com/11664433
* http://vimeo.com/19369928

It's what you would like to see, right? Maybe it's even more than you/we actually would like to see Smile
However, I think that's pretty cool stuff and having a similar completion engine for Eclipse could be very, very cool... I'll study the paper and will come up with more thoughts on this.

There is currently one issue with the completion engine. Applying the proposals does not work properly since JDT makes some nasty prefix checks before applying the proposal. And unfortunately applying "hashCode" on a prefix "cd" doesn't match and thus no code is inserted. I need to overcome this somehow. I guess it will take me a few hours to figure out a workaround.





tw: @MarcelBruch
tw: @Recommenders

[Updated on: Mon, 16 May 2011 08:41]

Report message to a moderator

Re: Fulltext autocompletion proposal [message #671049 is a reply to message #670925] Mon, 16 May 2011 15:50 Go to previous messageGo to next message
Sebastian Proksch is currently offline Sebastian ProkschFriend
Messages: 2
Registered: October 2010
Junior Member
I think subword matching could be very useful, especially for types with a lot of methods. I really think I would use it regularly.

This whole abbreviation stuff also sounds very interesting, but I don't know if I would use it very often. I think of it as a very big improvement to eclipses ability to complete abbreviations base on the capital letters of camel case identifiers (NPE<ctrl+space> -> NullPointerException)... and I use this feature very infrequently. It simply doesn't feel very intuitive for me to abbreviate a name and then complete it afterwards to full length, but I'm aware, that this is surely seen different by others.

As you get completing subwords for free if abbreviations work, I really like both approaches Smile (+1)
Re: Fulltext autocompletion proposal [message #671088 is a reply to message #671049] Mon, 16 May 2011 18:12 Go to previous messageGo to next message
Marcel Bruch is currently offline Marcel BruchFriend
Messages: 230
Registered: July 2009
Senior Member
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.

index.php/fa/2749/0/


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

index.php/fa/2755/0/



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


  1. send all your comments (positive and negative) to this forum,
  2. inform us about issues with the current implementation,
  3. if you want it to change in some way - tell us about it, and finally
  4. 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 Smile


The sources are available in git here: http://goo.gl/V9q14
The commit log is here: http://goo.gl/gLV9r




tw: @MarcelBruch
tw: @Recommenders

[Updated on: Mon, 16 May 2011 20:18]

Report message to a moderator

Re: Fulltext autocompletion proposal [message #671141 is a reply to message #671088] Mon, 16 May 2011 21:14 Go to previous messageGo to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1049
Registered: July 2009
Senior Member

If I type in super.Start+Cntr+Space it does not find the onStart() method. I believe it would be nice if it could.

It also would be nice if it would work to override methods in a class. E.g. I want to override onStart() in a class, JDT supports writing onS+Cntr+Space to select, would be cool if I could Start+Cntr+Space to create the method body.
Re: Fulltext autocompletion proposal [message #671144 is a reply to message #671141] Mon, 16 May 2011 21:39 Go to previous messageGo to next message
Marcel Bruch is currently offline Marcel BruchFriend
Messages: 230
Registered: July 2009
Senior Member
Right. I assumed that the prefix token is always in lower cases.

What is your expected behavior if a user enters a capital letter like 'S' in 'Start'? Should it match '(s|S)' or just 'S'? Just a bit like the CamelCase matcher.

Regarding completion on overrides.
I need to dig a little bit deeper how to implement it bit smarter to reduce the amount of glue code needed. I'll have look on this later this week.


tw: @MarcelBruch
tw: @Recommenders
Re: Fulltext autocompletion proposal [message #671307 is a reply to message #671144] Tue, 17 May 2011 12:56 Go to previous messageGo to next message
Marcel Bruch is currently offline Marcel BruchFriend
Messages: 230
Registered: July 2009
Senior Member
An update:

The latest version now respects upper case letters as suggested by Deepak and used by Lars. For example button.sT<^Space> now evaluates to '.*s.*T.*' whereas button.st would evaluate to .*s.*[tT].*. The underlying assumption is, that a developer who takes the additional effort to type an upper case letter has a clear vision what she is looking for.


We are currently thinking about some more advanced ranking concepts - we'll share them when ready... Smile


tw: @MarcelBruch
tw: @Recommenders

[Updated on: Tue, 17 May 2011 22:55]

Report message to a moderator

Re: Fulltext autocompletion proposal [message #671453 is a reply to message #671307] Wed, 18 May 2011 00:01 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 4
Registered: May 2011
Junior Member
Do you also plan to support fields? Goodjob so far btw :}
Re: Fulltext autocompletion proposal [message #671487 is a reply to message #671453] Wed, 18 May 2011 05:42 Go to previous messageGo to next message
Marcel Bruch is currently offline Marcel BruchFriend
Messages: 230
Registered: July 2009
Senior Member
Yes. I think it makes sense for fields, variables, overrides etc.

The reason why it's not implemented is that JDT's proposals were not designed to be extended from outside. Currently, I end up with copying most of the JDT code - I'm seeking for a smarter solution. But I think I'll spent some time on it end of the week.


tw: @MarcelBruch
tw: @Recommenders
Re: Fulltext autocompletion proposal [message #673287 is a reply to message #671487] Mon, 23 May 2011 06:24 Go to previous message
Marcel Bruch is currently offline Marcel BruchFriend
Messages: 49
Registered: July 2009
Member
Just a brief update for those that follow this thread only:

Paul-Emmanuel volunteered to take lead on the subwords completion. His
help is greatly appreciated. I'm looking forward to his first
contributions to Code Recommenders!

Best,
Marcel

P.S.: You may consider to subscribe to the forum's newsfeed here:
http://www.eclipse.org/forums/feed.php?mode=m&l=1&basic=1&frm=211&n=10
Previous Topic:Chain Completion - pure JDT-based Version
Next Topic:New Blog Post: Oh Stacktrace, My Stacktrace
Goto Forum:
  


Current Time: Sun Dec 21 15:11:15 GMT 2014

Powered by FUDForum. Page generated in 0.02376 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software