-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
IndexedReferenceFinder: possibly too wide scope of searching #2644
Comments
I mean for properties it also would make sense to take the visibility into account. Like searching for a private variable outside of the class makes no sense and searching for protected variables outside of the inheritance hierarchy makes no sense as well. |
For the record: in |
Yeah, but both should have a very limited scope. The variable only in the constructor and the member only in this class. |
Fwiw the legacy reference finder does take visibility into account and is obviously many times faster for private and protected members, it' a missing feature in the "new" system |
Okay, I think that might be an indexer problem, it's looking through all references of all files. Which for the |
@dantleech I have a question because it sounds so obvious:
Why don't we also index the context of the reference (for example the class name) into the record? Yes this increases the size of the index but it will drastically reduce the amount of work reference finding takes. |
AFAIK we do index the class name (the |
basically you don't need the indexer here, you only need reflection. so refactoring is probably required. |
I think I'm starting to understand the problem now and I completely agree that static analysis on indexing is a bad idea but maybe we could add a best guess, like if you're accessing |
For private and protected the speed can be i increased significantly by not using the indexer at all... which is exactly what the non LSP version does (and it's reliable as doesn't depend on thrnindex to work) |
For example, go to
lib/CodeTransform/Adapter/WorseReflection/Transformer/ImplementContracts.php
and find references to$reflector
private property.Currently as a user I get notifications about scanning ~300 references
![image](https://private-user-images.githubusercontent.com/11404453/324261958-1b1d83b8-54c0-4b8e-9ecd-17b09e497f4a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk1NTA4ODcsIm5iZiI6MTcxOTU1MDU4NywicGF0aCI6Ii8xMTQwNDQ1My8zMjQyNjE5NTgtMWIxZDgzYjgtNTRjMC00YjhlLTllY2QtMTdiMDllNDk3ZjRhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI4VDA0NTYyN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE4ZjNiY2M0ZTI3NmJiMzJiNWNkOTQ1YWVhZGJhOTA1ZGJjMDQxNTA3ZjI4ZGRmNzUzZmI4ZGNmNjM2ZWU0NmUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0._0q3P8KeXHTiiN0xGHaHNl6vEf5Kp30_EIUTmtuduPw)
I started to debug what happens. At the moment I see that:
$reflector
is detected as a variable, not a property. It probably needs some fixing.The text was updated successfully, but these errors were encountered: