A Magento plugin for padawan.php completion server.
Adds factory names completion when ones using Mage::helper()
,
Mage::getModel()
, Mage::getRosourceModel()
and Mage::getSingleton()
(Mage::getStoreConfig()
and Mage::getStoreConfigFlag()
are going to be add later).
It is also resolving types after using methods above.
The plugin is in the development phase and is not stable. Delivered as it is without any warranty. Use it at your own risk. Said that I'm using it every day for Magento development and so can you.
Plugin is working with stable version of padawan.php
(currently v0.2.1
). In the master version
plugins are not loaded, see #62.
The plugin can be install by the composer:
composer.phar global require pbogut/padawan-magento
Then plugin needs to be added to padawan server:
padawan plugin add pbogut/padawan-magento
In theory, that should be it. If you are not using composer in your Magento
project padawan may complain about vendor/composer/autoload_classmap.php
.
In that case its enough if you create that file and return empty array inside:
echo '<?php return [];' > ./vendor/completion/autoload_classmap.php
When you use it for the first time in your project, the plugin will check XML files
by using Mage
class. That may take few seconds, so completion may not work
with the first usage.
Currently, padawan does not support custom actions for plugins so there is no
easy way to detect XML file changes. To get up to date with completion for
Magento (ie. when XML file is changed, or new extension added) padawan
server need to be restarted. The plugin is also implementing the hackish way to
rebuild data when you type
However, the plugin is checking for flag file in a Mage::padawan_refresh(
in any PHP file..padawan
directory in
a project root. If there is magento_reload_xml
file plugin will refresh data
from Magento XML files.
This can be automated by an editor. Below example for Vim:
:autocmd BufWritePre *.xml :silent! !touch .padawan/magento_reload_xml
MIT
Any contribution is welcome.