开发者

Auto-Complete Suggestions in Source Code Editor

开发者 https://www.devze.com 2022-12-29 05:59 出处:网络
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).

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 qui开发者_如何转开发ckly 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!


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.


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.


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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号