AutoActivation doesn't work

General Discussion on RSyntaxTextArea.

Moderator: robert

AutoActivation doesn't work

Postby as3boyan » Mon Sep 16, 2013 8:47 pm

AutoCompletion ac = new AutoCompletion(provider);

I tried in sample, but it doesn't work. is it works?
It would be cool to have autocomplete on ".".
Posts: 19
Joined: Mon Sep 16, 2013 8:21 pm

Re: AutoActivation doesn't work

Postby robert » Wed Sep 18, 2013 12:14 pm

In your CompletionProvider, have you called setAutoActivationRules() to add "." to the list of characters to auto-complete after? By default auto-completion only occurs after letters. Note you'll also have to override isValidChar() (assuming you're using DefaultCompletionProvider) to add '.' as an acceptable identifier character.

java code:

DefaultCompletionProvider provider = new DefaultCompletionProvider() {
protected boolean isValidChar(char ch) {
return ch=='.' || super.isValidChar(ch);
provider.setAutoActivationRules(true, ".");
User avatar
Posts: 852
Joined: Sat May 10, 2008 5:16 pm

Re: AutoActivation doesn't work

Postby as3boyan » Thu Sep 19, 2013 9:52 pm

Wow! I didn't knew that it works this way(And modified AutoComplete code to get "." working). This is very cool! Thank you very much!

Now I think I should add some more rules :)

It seems like I don't need to override isValidChar, because that will change position of caret passed to my completion impl.(I override getCompletionImpl()). Works perfectly!
Posts: 19
Joined: Mon Sep 16, 2013 8:21 pm

Return to Open Discussion

Who is online

Users browsing this forum: No registered users and 1 guest