A useful feature I've been thinking about for awhile (in a scripting sort of
fashion, but it would work even better in jde) is auto-insertion and sorting
of import statements.  As a general coding practice, I avoid ever using * in
import statements.  In almost every case, when I use class Foo in code, I
want to import Foo from it's first occurrence on the classpath... so with
this feature enabled, I could type "Foo blegga = new Foo()" and the

import com.warga.bar.Foo;

statement would be automatically inserted in the import block at the top of
the file, if it wasn't already there, the next time the class is compiled.

Other useful side-effects: imports could be sorted alphabetically and a
newline inserted at package boundaries.  Also, classes that are no longer
used could be eliminated from the import block - over time, this becomes
very useful for maintaining the actual dependencies of your classes.

This would be a huge time-saver for the work I do - I wonder if jde-parse
could help do this?  The hard parts about this feature is the collection of
class names from the file, and the identification of package-level classes
that don't need to be imported.  Otherwise it should be a straightforward
matter of classpath-parsing and final sorting.

Oh, and to save some email bandwidth, I recognize (and mostly agree with)
the general principle that many folks have with anything that changes code
"behind the back" of the developer.  I just think that in this case the time
saved and value added would far outweigh any possible confusion generated.
As with all power features, only those who are comfortable with it need use
it.

Just a thought-

//Thomas
Thomas K. Burkholder

> -----Original Message-----
> From: Paul Kinnucan [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 05, 1999 7:58 AM
> To: Rodrigo Reyes
> Cc: [EMAIL PROTECTED]
> Subject: Re: smart completion
>
>
> At 12:03 PM 5/5/99 +0200, you wrote:
> >
> >  What is the current state of the smart method/variable completion,
> >which was announced, IIRC, for the beginning of 1999 ? I remember the
> >announce was done in december '98, while I was working on such a thing
> >(which was alpha-working), so I gave up waiting for JDE's
> >implementation.
> >
>
> I am working on this feature. So far I have created a Java parser, using
> JavaCC, and  interfaced the parser to the JDE  via the JDE's
> BeanShell Java
> source interpreter.The method/field completion logic will  use this parser
> to determine the class of the object at point. I plan to work on the code
> to determine the class at point next. Once this is done, I will do the
> completion logic, which is fairly trivial, once you know the class of the
> object at point. I hope to have the feature ready for release in
> early June.
>
> I have  implemented a  new command, jde-parse, that invokes the
> Java parser
> on the file displayed in the current buffer. The parser is very
> quick on my
> Pentium 200 machine. The parser command allows you want to check the file
> for syntax errors without having to compile the file. If there is
> interest,
> I could release this command right away.
>
> - Paul
>

Reply via email to