TemplateCompletion separated from CodeCompletion

Questions on using RSyntaxTextArea should go here.

Moderator: robert

TemplateCompletion separated from CodeCompletion

Postby goran_schwarz » Tue Feb 19, 2013 1:58 pm

He there!

You wrote in the blog post http://fifesoft.com/blog/?p=533
that you "want to emulate" Eclipse behavior, which is nice, then people do not have to "relearn" stuff :)

I want to use CodeCompletion and Templates at the same time, which works...
But I want to be able to separate them as Eclipse does.
ctrl+space: bring up the code completion
ctrl+space seconds time: show the templates

In this way it will be easier to distinguish between Code and Template Completion

I have a SQL Code Completion, and I also want to have Template Completion
But if they are both in the same window (at the same time) it's hard to find the templates because of *all* the table/view/procedures/etc names in there...
And many times I just want a Template, to start writing various SQL Constructs

Thanks for great work on this library
/Goran
goran_schwarz
 
Posts: 6
Joined: Tue Aug 23, 2011 12:38 pm

Re: TemplateCompletion separated from CodeCompletion

Postby robert » Fri Feb 22, 2013 2:24 pm

I've thought about this in the past. It would require a moderate amount of work, and I'd imagine many folks using the library would not want to distinguish between the two, for simplicity's sake. So it would have to be an option somehow, categories of different Completions cycled through I'm thinking.

Please enter a Feature Request so this can be tracked.
User avatar
robert
 
Posts: 774
Joined: Sat May 10, 2008 5:16 pm

Re: TemplateCompletion separated from CodeCompletion

Postby goran_schwarz » Mon Apr 22, 2013 12:41 pm

If I want to implement this myself!
Can you give me a hint where to start changing/overriding the code :)
Thanx /Goran
goran_schwarz
 
Posts: 6
Joined: Tue Aug 23, 2011 12:38 pm

Re: TemplateCompletion separated from CodeCompletion

Postby robert » Tue Apr 23, 2013 12:46 pm

The best place to start is to look at the CompletionProvider interface and its implementations. CompletionProviderBase is the "parent" class of all built-in CompletionProviders, and its getCompletions(JTextComponent) method is currently hard-coded to sort all completions by their relevance, then return the list. You'd want to consider changing this method to return a List of Lists, with each List representing a different list of Completions the user can cycle through.

Then you'll have to update the actual UI code to handle the List of Lists. It starts in AutoCompletion#refreshPopupWindow(). That's where to start.

It would probably be best to create a container class for different sets of Completions to cycle through, rather than a List of Lists. Something like:

java code:

public class CompletionListSet {

/**
* Map of list "names" ("click to show 'Basic'/'Template'/'Other' Proposals") to the list of completions for it.
*/
private Map completionLists;

public void addCompletionList(String name, List completions);

public Map getCompletionLists();

}
User avatar
robert
 
Posts: 774
Joined: Sat May 10, 2008 5:16 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 1 guest

cron