Closed Koc closed 7 years ago
There is an intention to create observers: Create Observer intention. Use ALT+ENTER when cursor is over some eventname string in dispatch method and select Create Observer. ->dispatch('[ALT+ENTER HERE]') I'm working on better autocomplete for XML files too
IMHO this is not intuitive behavior. Some actions available on alt+m, some on ctrl+enter. Also sometimes is impossible generate observer for events like
$this->eventManager->dispatch('layout_render_before_' . $this->request->getFullActionName());
Better to be consistent: add new action alt+m - create observer (below search events) with event name field wich autocompletes events
@Koc is consistent with the way PhpStorm works. PhpStorm uses intention actions (ALT+ENTER shortcut) to create code depending on the element under current cursor position, PhpStorm allows to create a method, property, class etc in this way, and Magicento is adding things like observers, dependencies, plugins etc. Magicento tries to extend all the normal shortcuts from PhpStorm, that's why you can use CTRL+SPACE for autocomplete, or CTRL+B to jump to some element etc. ALT+M is a special shortcut for things that are not compatible with any other shortcut from PhpStorm, like creating a new Module, Controller, Grids, Execute PHP actions (template hints, etc), or jump to other files based con current file (not current element), etc. I highly recommend to read the changelog from Magicento, all the features are explained there, I know it's boring but is the only way you can get the major benefits from the plugin (and you can be always up to date with features just reading the new changelog when you update)
regarding to that event, is really hard to guess what is the full event name when it's dynamic like in that case
Generated class namespace duplicates Observer
subnamespace
<?php
namespace Brouzie\PrimaryCategory\Observer\Observer; // observer twice
use Magento\Framework\Event\ObserverInterface;
class CatalogProductCollectionLoadAfter implements ObserverInterface
{
public function execute(\Magento\Framework\Event\Observer $observer)
{
// ...
}
}
fixed in 1.6.0
Also there is no autocomplete for classes