I have a problem with autocomplete when I define a subroutine with input parameter of type MIME:Entity.
From the perspective of the subroutine it is a reference. How can I make the IDE to understand that this input parameter is of type MIME:Enity and provide me with autocomplete ?
sub subWithNoAutocompleteOnEnity
{
my ($entity) = @_;
my $test = MIME::Entity;
bless $entity, $test;
if ($entity->parts(0)) {
print("Say hello")
}
}
my $parser = MIME::Parser->new;
my $entity = $parser->parse_open("$inputDirectory/$filename");
subWithNoAutocompleteOnEnity($entity)
A lexical variable can be declared with a TYPE attribute, see https://perldoc.perl.org/functions/my, you can use this to help the Perl plugin to know what type the variable is, and how to autocomplete. Example:
use MIME::Entity;
sub subWithNoAutocompleteOnEntity
{
# Using the type MIME::Entity to help the Perl plugin to autocomplete
my MIME::Entity $entity = shift;
if ($entity->parts(0)) {
print("Say hello")
}
}