通过 Camelcade / Perl5-IDEA 插件在 Perl IntelliJ 中的子例程中自动完成

问题描述 投票:0回答:1

当我使用 MIME:Entity 类型的输入参数定义子例程时,我遇到自动完成问题。

从子程序的角度来看,它是一个参考。如何让 IDE 理解此输入参数的类型为 MIME:Enity 并为我提供自动完成功能?

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)
perl intellij-idea camelcade
1个回答
0
投票

可以使用 TYPE 属性声明词法变量,请参阅 https://perldoc.perl.org/functions/my

尝试以下操作:

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")
    }

}
© www.soinside.com 2019 - 2024. All rights reserved.