Hello Perl coders!
Got a problem and possible solution, need a feedback from community.
As you may know, I'm currently working on Perl5 plugin for Intellij IDEA, and work is going fine, it works and can do a lot of useful things. But i've encountered a problem.
In order to link sub usage and it's definition or declaration, i need to know, in which namespace to look. And it's not a problem when you are using obvious calls:
somesub(); # just looking current namespace Foo::Bar::somesub(); # obviously, looking in Foo::Bar # and now you can even do this: my Foo::Bar $object; $object->somesub(); # will understand that it's a Foo::Bar's sub
But, what to do when it's used like:
Foo::Bar->new()->some_geter()->somethingelse();
Of course, it's possible to constantly work on smart algorythms, which will be able to analyse previous sub in "dereference" chain and try to guess, what was returned.
But it's an endless work as a Perl itself and resourse-consuming.
I belive that the best way here is to introduce a Java-like annotations:
#@Returns Foo::Bar sub somefunc{ ... }
Here, IDE parser can easily find out, that somefunc returns Foo::Bar object. And from the Perl's perspective, it's still just a comment.
Currently thinking about following annotations:
There are lot of useful IDE hints could be, like #@defined, #@undefinable and so on, but these above i really need.
I thought about using attributes, but not sure it's such good idea, and, btw, it would be easy to convert such form of annotations to another one if Perl devs introduce something useful for this.
Really need a feedback and ideas.
In reply to Annotations for Perl by hurricup
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |