editor tags

mr_bean on 2006-07-05T02:24:14

I'm really excited by osfameron's Perl::Tags with vim, because it creates tags as you go. Tags are great for clicking your way round your code. However vim's tags are created statically.

Perl::Tags creates them dynamically as you jump from one module to another. The problem before it was, You never knew where you were going to go, and it was impossible to create tags for all the things you might be interested in beforehand. So you ended up never using tags outside your own code.

But with Perl::Tags, you don't have this restriction. It helps me moving back and forth between my garden of relatively well-understood code and the jungle of code outside my garden which I need to subdue.

You can also write regex to create tags not just for subs, vars and packages, but for anything you can parse. ctags could do this, eg tagging Spiffy fields

ctags "--regex-perl=/^\s*field '?(\w+)(';| => .*;)$/\1/f,field,class attribute accessor methods/" -R

But it's nicer to be able to do it as part of a perl module.


Adding new tag parsers

osfameron on 2006-07-05T09:02:42

Thanks for the feedback: I'm interested that you're thinking about extending it to tag other things - how are you tackling this? Subclassing Perl::Tags::Naive and replacing get_parsers and adding new parsers there? (I can change get_parsers to use $self->can('package_line') instead of \&package_line to make it easier to subclass).

Or if you have a better approach to extending, let me know!

Re:Adding new tag parsers

mr_bean on 2006-07-05T12:59:11

I don't know what the best way to do it is. The easiest way was just to cut and paste into Tags.pm, but when I lost my changes installing 0.21, I decided I had to subclass.

I expected I would only have to add the new parser into my subclass, but I also had to have the old parsers there too, which was a little surprising.

The parsers are subroutines, rather than methods?

Re:Adding new tag parsers

osfameron on 2006-07-05T17:31:44

OK, version 0.22 (shortly on CPAN, or on http://greenokapi.net/svn/code/Perl-Tags/ till then) now has tests, including a subclassing test module (t/TodoTagger.pm) and a little documentation pointer in Perl::Tags itself. Hope it helps.