Jim
Jim

Reputation: 2161

Auto-Complete Suggestions in Source Code Editor

Most IDEs (Eclipse, Netbeans, Intelij) provide contextually smart suggestions about the current statement you're writing. We would like to do the same thing (In Java for Java).

We considered tokenizing the input and building our own abstract syntax trees, but quickly realized that could be a month long project in and of its self. We also started digging through the source code for the above mentioned IDEs, but it appears (correct me if I'm wrong) that the auto-complete code is pretty tightly woven with the rest of the IDE.

We're wondering if anyone knows of a relatively isolated package that we could pull into our project to provide this auto-complete functionality.

Thanks!

Upvotes: 4

Views: 3202

Answers (5)

SEK
SEK

Reputation: 1222

You could try using the Reflection API if you are willing to support auto-compilation and limit your auto-complete to already-compiled classes. Otherwise, you're looking at a very large, long project that will require a lot of resources to complete.

Upvotes: 1

user452425
user452425

Reputation:

You should check creating custom editor for Eclipse. Without much effort tokenizer, code assist and coloring support could easliy integrated to your editor. With some effort you could minimize dependency and ship only required plugins. Altough eclipse do the most things for you there is no standard way to parse content. You could use Xtext or write your customer parser with antlr.

Upvotes: 1

Dany
Dany

Reputation: 167

Solution is http://fifesoft.com/projects.php

Upvotes: 0

mklhmnn
mklhmnn

Reputation: 4950

JIDE-Commons offers a simple "completion" feature which can be used, e.g., to complete simple words or file names. Maybe this simple solution already works for you.

Upvotes: 0

Daniel
Daniel

Reputation: 28074

If you use SWT and JFace you can be happy: Autocompletions on the GUI side in Editors are already included, and is discussed in many toturials.

However with Swing you might look a bit further.

What is useful in your context has to be decided by yourself, as far as i am aware, there are no tools for that, except when you using a DSL framework like xText.

Upvotes: 0

Related Questions