phpcomplete.vim
phpcomplete.vim copied to clipboard
Autocomplete namespaces from project
Hello
First of all, thank you so much for the plugin. It works really well. However I'm missing two things. When I work on symfony project and import classes via use \namespace1\namespace2 - autocompletion works perfectly, but sometimes I don't know where the class is and it would be nice to type just the class name and a to be able to see a list of namespaces where class with such name exists. Possible?
Also another option I'm missing is namespace autocompletion from project tags file. I'm using phpctags to generate my tags.
Thanks!
Hi
I believe the first scenario is doable albeit could be slow (well, what's isn't slow with this plugin 😅) In the tag files you've the following type of information for classes:
Level31 foo_inheritance_level31.php /^class Level31 {$/;" c namespace:NS31\SubNS
The thing you can search for with pattern matching is the first column, however once you've the results you've access to the namespace:...
part. The only thing is that so far the philosophy was that we tried to be accurate with the responses and/or touching the already typed in base could be annoying, but i believe it's doable (might wanna hide it behind some settings value).
As for namespace completion: I believe we already do something similar around the use ...
context, you'll get namespace suggestions already (altho it won't search in tags without you typing in at least one letter). I'm not sure what exact context you mean for this one. The tags database do contain all the namespaces as individual items, so the raw data is there.
Sorry, for the late reply.