I managed to pack my work on code completion to a distribution and released it to the CPAN. The source code is managed on github. Use it, watch it, fork it, break it, fix it, patch it … you know the game!
Watch the demo for new features (no audio).
So what is missing?
It would be great if code completion works for chained method calls:
# DateTime my $dt = DateTime->new(year => 2009); $dt->add( months => 1)->_ # we are still a DateTime object! # in a DBIC environment my $rs = $schema->resultset('Foo')->_ # we get a MySchema::ResultSet::Foo
What we need is a way to define the return values of methods. Moose’s type system is not much of a help because you cannot introspect what class is behind a custom type.
I was thinking about an IntelliPerl profile which is stored in the home directory as well as in each project. Those two are merged and define method signatures and variable types.
Possible syntax:
# ~/.intelliperl $schema isa DBIx::Class::Schema; $rs isa DBIx::Class::ResultSet; $dt isa DateTime; method DBIx::Class::ResultSet::search returns DBIx::Class::ResultSet # ~/workspace/MyApp/.intelliperl $schema isa MyApp::Model::DBIC $rs isa MyApp::Schema::ResultSet
A different approach would be to add the method signature to the POD:
=head2 mymethod
=for intelliperl
method mymethod ($dt DateTime) returns DateTimeThis will make $dt inside mymethod a DateTime variable and the returned value is a DateTime object as well.
For now only TextMate is supported. See the documentation for details.
I’d love to see more Devel::IntelliPerl::Editor::s!

