[PhpStorm] Plugin for aspect-oriented programming
I'm developing a plugin for PhpStorm for aspect-oriented programming (https://plugins.jetbrains.com/plugin/7785) and there are some question that I cannot answer myself. Please, could you help me in this thread with some answers, I'll put an questions here in the case I stuck in something.
My starting point is:
- Lexer and parser for pointcut expressions: https://github.com/goaop/idea-plugin/blob/master/src/com/aopphp/go/parser/pointcut.bnf
- Syntax highlighter and color settings page https://github.com/goaop/idea-plugin/blob/master/src/com/aopphp/go/PointcutQuerySyntaxHighlighter.java
- Automatic pointcut language injection into php.lang.psi.elements.StringLiteralExpression (Doctrine annotations and PointcutBuilder methods string literals)
- Paired brace matcher (it was so easy to implement, thanks!)
- Several completion contributors: for keywords and doctrine annotations (thanks to the PHP Annotation plugin API)
Now I'm stuck with the most interesting part: I want to develop LineMarkerProvider that will add an icons near matching PHP methods, properties and classes with ability to navigate to advice/from advice. In the order to implement this I want to extend PSI elements with methods to create a patterns and then check all items if they matcing specific patterns. From what I can see, all interesting items for me are implementing "php.lang.psi.elements.PhpNamedElement", so first questions:
- How to get all avaliable php.lang.psi.elements.PhpNamedElement items in the project?
- What is the best way to get a matcher for PHP items from my top-level PSI (psi.PointcutExpression)? Is it ok to build pattern matcher on every first access to the psi.PointcutExpression.getPointcutMatcher() that will give me an instance of ObjectPattern?
Please sign in to leave a comment.