Jens Lautenbacher writes:One could look at the java naming conventions for hints to determine the kind of entity we are trying to complete.
> Hi,
> > I try to figure out why completion does not work when I try to complete
> on a Class name. Say the class FooBarBaz is somewhere on my classpath,
> and I'm in a source buffer with point just after Foobar (the ^ denotes
> point):
> > FooBar
> ^
> > trying to complete on the classname doesn't work, but I don't understand
> why this is not enabled. When I have > > FooBarBaz
> ^ > > trying to complete will insert an import statement for FooBarBaz and
> leave my buffer looking like this
> > FooBarBaz()
> ^
> > So JDE already recognizes that the thing before point should be tried as
> a classname, and an import statement should be generated if it is found.
> Why can't it try to complete on the prefix FooBar then?
Because no one has yet bothered to implement completion of class names, which is a fundamentally different problem from completion of class methods and fields.
> I even think that the () shouldn't be inserted into this case, because > most often what I try to do is something like FooBarBaz fbz = new > FooBarBaz(...) with completion on the available classes.
So supposing somebody took the trouble to implement completion of
class names, how do you think the user should convey to the JDEE that
they are seeking completion of the constructor as opposed to
completion of a class name?
FooBar
^
would lead to classname completion, while
fooBar
^
would not.Another option would be only complete against imported classes (and classes in the same package). This would not be
as costly as always trying to complete against all classes in the classpath.
Btw, there does seem to be a bug similar to the one Jens pointed out. If you run jde-complete at
foo.bar(). and foo.bar()
^ ^
you get the same completion list. Note the missing "." in the second example. After choosing say baz(), the lines look like
foo.bar().baz() and foo.bar()baz()
Perhaps a "." should be inserted in the second case?
Suraj
