[Idea] PHP namespaced class `use` completion


#1

Here’s an idea that could probably be implemented as an add-on.

PHP has namespaces now and plenty of projects are adopting it (Symphony, Yii, and other MVC frameworks, plus a number of composer modules).

Rather than having to C&P long classnames into a use ...; line so you can use simple names in your code. It would be nice if there was a command that would open something like the [Ctrl/Cmd]+T file selector to select a php file and then on selection would add a use ...; line for the class inside that file.

Bonus points if it triggers like an autocomplete option when you type use in a place where the use keyword belongs.

Extra bonus points if there’s an option or an additional plugin that scans for all the namespaced classes, lists similar class names inside the autocomplete when you type them out, and on autocomplete activate adds the necessary use line to the top of the file. (however the code scanning for that may be expensive so the command to add use lines yourself should not be sacrificed to implement that ide like functionality)


#2

This could be implemented as an autocomplete-plus provider.