AutoComplete problem with popup disappearance

General Discussion on RSyntaxTextArea.

Moderator: robert

AutoComplete problem with popup disappearance

Postby Pylo » Thu Mar 15, 2012 2:55 pm

I'm devloping app that uses AutoComplete addon library. i've added it to RSyntaxTextArea an everything looks OK. But when you type more than 3 characters, AutoCompletePopupWindow disappears. I have already looked in JavaDOC page and source too, but i can't find solution :shock:. In RText this thing is working OK, why it isnt working for me? Please someone help me.
Pylo
 
Posts: 3
Joined: Thu Mar 15, 2012 2:47 pm

Re: AutoComplete problem with popup disappearance

Postby robert » Thu Mar 15, 2012 10:30 pm

Is it always the fourth character that hides the popup window, or is it variable? Is the character that hides the window a letter/digit/underscore, or something else? Note that if you're using a DefaultCompletionProvider, by default the isValidChar(char) method only accepts specific "word" characters. Anything else may cause no completion matches to be found and the completion popup to hide.

More information on your setup would be necessary to diagnose the problem. Are you using DefaultCompletionProvider and an input XML file listing possible completions? Or are you doing a more custom CompletionProvider?
User avatar
robert
 
Posts: 797
Joined: Sat May 10, 2008 5:16 pm

Re: AutoComplete problem with popup disappearance

Postby Pylo » Fri Mar 16, 2012 7:31 pm

Popup hides when you type more than three characters of any type. I'm using DefaultCompletitionProvider, VariableCompletition and FunctionCompletition. I've programmed code, that loads functions and variables using reflection to DefaultCompletitionProvider. Than code adds descpription based on JavaDOC. I've also made new CellRender for JList, that uses icons for function and variable completition. Here i'll post parts of my code:

Implementation of completition provider:

AutoCompletion ac = new AutoCompletion(provider);
ac.setShowDescWindow(true);
ac.setAutoCompleteSingleChoices(false);
ac.setParameterAssistanceEnabled(true);
ac.setListCellRenderer(new JavaCellRenderer());
ac.install(textArea);

Than I add completitions to DefaultCompletitionProvider dinamicly (when yout type ".", it loads all functions and add them to DefaultCompletitionProvider - old completitions are removed):

provider.clear();

for(int i = 0; i<meth.length; i++){
Method method = (Method) meth[i];
FunctionCompletion fc = new FunctionCompletion(provider, method.getName(), method.getReturnType().getSimpleName());
fc.setShortDescription(DOCParser.getDesc(method.getDeclaringClass().getName(), method.getName()));
ArrayList list = new ArrayList();
Class[] clas = method.getParameterTypes();
if(clas.length>-1)
for(int is = 0; is<clas.length; is++){
list.add(new ParameterizedCompletion.Parameter(clas[is].getSimpleName(), ""));
}
fc.setParams(list);
provider.addCompletion(fc);
}

Problem is, because three characters are in word "set", so if you want to get AutoCompletition for example "setSize", you type "set" and popup disappears, so you can't use AutoCompletition for functions with name, longer than three characters .
Pylo
 
Posts: 3
Joined: Thu Mar 15, 2012 2:47 pm

Re: AutoComplete problem with popup disappearance

Postby robert » Sat Mar 17, 2012 2:00 pm

Hmm, offhand I can't think of what the problem might be. Can you email me a small sample project that demonstrates the problem?
User avatar
robert
 
Posts: 797
Joined: Sat May 10, 2008 5:16 pm

Re: AutoComplete problem with popup disappearance

Postby Pylo » Sun Mar 18, 2012 11:34 am

I've solved this problem. Problem was, that every third character, app checked current code and made new completition, so old was deleted. When you clear DefaultCompletitionProvider, popup hides.
Pylo
 
Posts: 3
Joined: Thu Mar 15, 2012 2:47 pm

Re: AutoComplete problem with popup disappearance

Postby sureshkumarC » Mon Oct 08, 2012 4:36 am

hi,
im using autocomplete, when i type "." the popup window disappears. What should be done
sureshkumarC
 

Re: AutoComplete problem with popup disappearance

Postby robert » Mon Oct 08, 2012 12:14 pm

Suresh,

It's tough to know for sure without more details. Are you using DefaultCompletionProvider with your own Completions? Or are you using RSTALanguageSupport, and if so, what language?

If you're using DefaultCompletionProvider, and want "." to be a valid character in completion text, be sure to override the isValidChar(char) method to also return true for ".", as mentioned above, since it does not do so by default.
User avatar
robert
 
Posts: 797
Joined: Sat May 10, 2008 5:16 pm


Return to Open Discussion

Who is online

Users browsing this forum: No registered users and 3 guests

cron