Code completion features for Java.

General Discussion on RSyntaxTextArea.

Moderator: robert

Code completion features for Java.

Postby Szymon M. » Wed Jan 22, 2014 11:13 am


Are you planning to expand functionalities of code completion for Java (SYNTAX_STYLE_JAVA)?

It works great so far, but I've noticed to things:
1. It works only 1 level deep.
2. When used on static class, it did not show static methods of that class, only fields.

It shows such texts in both above cases:
[DEBUG]: Qualified non-this completions currently only go 1 level deep
[DEBUG]: Only identifier non-this completions are currently supported
I've noteiced in code, that these were put on "TODO" a while ago.

Anyway, I would like to thank you very much, for creating such powerfull component as RSyntaxTextArea. I'm currently writing an application, that simplifies writing programs in Java, using LeJOS ( for LEGO MINDSTORMS programmable bricks. I used to use JSyntaxPane which is also quite good component, but almost gave up when came to code completion feature. Then desperately searching for solution, I've found RSyntaxTextArea and I was astonished what it can do :-)

Best regards
Szymon M.

Re: Code completion features for Java.

Postby robert » Sat Feb 01, 2014 12:48 am

I'd love to get back around to this (at one point I had a lot of effort going into the Java language support), but it's unfortunately completely lost steam for awhile, as you have noticed. My free time has gone into more general enhancements to RSTA, as well as better code completion for web-based stuff such as HTML, JS, and CSS. I do have some plans for at least some basic maintenance to the Java code completion:

    1. Allow > 1-level deep completions, even if they are for simple cases (e.g. fields such as System.out.println(), simple getters such as foo.getValue().getSubValue())
    2. Finding static methods in static classes (which I'm surprised doesn't already work)
    3. Better calculation of what local variables/fields are of a type appropriate for parameter completion suggestions.
    4. Update for the Java 8 syntax changes.

As there's a limit to how much time I have (and knowledge about parsing!), it might be better to find an open-source Java 8 parser that we can embed. We only really need to identify basic class/interface/enum structure (e.g. methods and fields) and local variables in fields, with decent error recovery (since code in a text editor is often incomplete). Then assuming it's way smarter than what we have today. we'll be better equipped to code complete more complex expressions.
User avatar
Posts: 852
Joined: Sat May 10, 2008 5:16 pm

Return to Open Discussion

Who is online

Users browsing this forum: Google [Bot] and 3 guests