I am editing packages that use Moose, and I was wondering if there were a plugin for making Moose attributes show up in the Tag List.
For example, in the following code, the attribute options
does not show up in Tag_List, but print_out_site
does:
use Moose;
use MooseX::AttributeHelpers;
...
has 'options' => (
metaclass => 'Collection::Hash',
isa => 'HashRef[Str]',
is => 'ro',
provides => {
exists => 'exists',
get => 'get',
set => 'set',
},
);
...
sub print_out_site {
my $self = shift;
my $key = shift;
$self->fasta_out_fh->print(">", $key, "\n");
$self->fasta_out_fh->print($self->sites->{$key}, "\n");
}
Add the line
--regex-perl=/has '(.*)' => \(/\1/a,attribute,moose attributes/
to ~/.ctags and it should show up. You may need to tweak the regular expression to avoid spurious matches in other files or to accommodate different formatting for the attribute declarations in other files.
This extends ctags so that it detects another type of tag based on the regular expression when parsing perl files.
Then you need to tell the taglist plugin about the new tag type by adding this to your vimrc file:
let tlist_perl_settings='perl;c:constant;l:label;p:package;s:subroutine;a:attribute'