Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add links from advices to the advised elements #5

Closed
lisachenko opened this issue Mar 27, 2016 · 4 comments
Closed

Add links from advices to the advised elements #5

lisachenko opened this issue Mar 27, 2016 · 4 comments
Labels
Milestone

Comments

@lisachenko
Copy link
Member

It would be nice to have a links from advices to the concrete elements. Unfortunately, it's very expensive operation, because I need to take one single pointcut and then match it for all PhpNamedElements such as Method and Field.

There is a branch feature/navigate-to-advised-elements with working implementation, but some kind of optimization should be done, before using this for real projects.

@lisachenko
Copy link
Member Author

Hi, Daniel! /cc @Haehnchen Sorry for the trouble!

Could I ask your for an expert advice? Previously, you pointed me into the right direction and this gave me the ability to finish the main part of my plugin! Now PhpStorm can analyze any pointcuts and shows links to aspect classes + their advices, it's so cool! Thank you very much! )

Now I want to provide line marker from advices to the advised elements and realized, that this task can't be done easily by taking the pointcut expression and matching it for all PhpClassMemebers such as Method and Field, because it requires to perform checks for thousands of elements and naviagtion icon will appear only after several seconds.

Is it possible somehow in IDE to create a cache with matching elements in background? My primary idea was to take my index with pointcuts, then perform checks for each element in PhpMethodIndex and PhpFieldIndex indexes, then store result in a HasMap<Pointcut, List<PhpNamedElement>> and invalidate it when pointcut or matched file is changed.

Thank you in advance!

@Haehnchen
Copy link

i am using this for symfony services and a symfony like event subscriber use case:

@lisachenko
Copy link
Member Author

Thank you very much! 👍 I need some time to think about your solution and check if it can be used for me. Will answer here about results

@lisachenko
Copy link
Member Author

Hmm, your pre index filter knows which element to look for, but for my case I don't know exactly the names of methods to search. Is it possible to use an index to create another index, or this will produce an exception?

Lazy target linemarker - looks promising, is it ok to check 20-30k elements in runtime for lazy linemarker?

Your last link is very good, it has many common with my hooks ) But it's unclear how to invalidate this cache when one of the following changed: aspect class, which contains a pointcut with advice, concrete class with methods. I'm not familiar wit caching system, but looks like there are special events which I can handle to invalidate only part of that cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants