perl-language-server
perl-language-server copied to clipboard
Support for "has" attributes
Hello,
it would be great, if PLS would support the "has" attribute definitions from the Moose/Moo/Mo implementations of Perl, to be usable in the outline part of VSCode.
has 'node' => (is => 'rw', isa => 'Any');
has 'children' => (
is => 'ro',
isa => 'ArrayRef',
default => sub { [] }
);
has 'parent' => (
is => 'rw',
isa => 'Tree',
weak_ref => 1,
handles => {
parent_node => 'node',
siblings => 'children',
}
);
has taste => (
is => 'ro',
);
has brand => (
is => 'ro',
isa => sub {
die "Only SWEET-TREATZ supported!" unless $_[0] eq 'SWEET-TREATZ'
},
);
has pounds => (
is => 'rw',
isa => sub { die "$_[0] is too much cat food!" unless $_[0] < 15 },
);
has name1 => ( default => sub { 'Joe' } );
has name2 => ( builder => 'name_builder' );
has name3 => ( coerce => sub {$_[0]} );
has name4 => ( is => 'ro' );
has name4 => ( required => 1 );
Apart from that, the step to Perl's Cor implementation would also be a bit smaller.
Thanks for the suggestion. You're right, there should be some handling for commonly used OO systems in Perl.
I'll probably wait until it's a bit more mature before working on feature 'class'