bobbylight / AutoComplete

A code completion library for Swing text components, with special support for RSyntaxTextArea.
BSD 3-Clause "New" or "Revised" License
166 stars 55 forks source link

Auto show complete window #72

Closed Sanysvo closed 4 years ago

Sanysvo commented 4 years ago

Hi, how i can do it: i want press trigger key, i want print code and get autocomplete window.

wangqs-mobilestone commented 4 years ago
provider.setAutoActivationRules(true, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
bobbylight commented 4 years ago

You should be able to get away with just:

provider.setAutoActivationRules(true, null);

Since the boolean first param should auto-add [A-Za-z] (really, after anything matching Character.isCharacter(char)).

The second param is for additional, non-letter characters, such as . if you built in the smarts for method completions:

provider.setAutoActivationRules(true, ".");

Or were adding auto-complete for a language where non-letter characters were valid in an identifier, such as $:

provider.setAutoActivationRules(true, "$");

I must say, this question comes up a lot. I think the AutoComplete API isn't very well documented. I will take an action item to beef up the documentation, in the README.md and/or create a wiki for it.