Atwix / phpstorm-plugin-feedback

6 stars 0 forks source link

When using the "Create a new plugin" functionality, only some of the custom modules are shown #52

Closed norgeindian closed 6 months ago

norgeindian commented 7 months ago

How is decided, which modules are shown in the mentioned functionality? We have about 50 custom modules, all under the same namespace and in the same folder, and only about 10 or 15 can be chosen in the popup.

bohdan-harniuk commented 7 months ago

Hello @norgeindian,

To confirm module locations, please clarify: are all of your modules situated within the default Magento source root, which is typically the 'app/code' directory? If not, have any custom source roots been configured?

Screenshot 2023-12-04 at 14 19 20

Regards,

norgeindian commented 7 months ago

@bohdan-harniuk , we have our custom modules in the src directory and this directory is also added to the project: image

The strange thing is, that some of the modules are present in the dropdown and some are not. Do you see any other reason which could lead to this behaviour?

bohdan-harniuk commented 7 months ago

@norgeindian,

Yes, there is a possibility that some modules might not be added to the index. This can only occur if the registration.php file contains content that the plugin is unable to parse.

To check whether the target modules are indexed or not, please install the Index Viewer module.

Screenshot 2023-12-05 at 14 17 24

Once installed, follow these steps to locate the missing module:

  1. Open the Indexes Tool Window located in the top right corner.

Screenshot 2023-12-05 at 14 18 26

  1. Search for the module name

Screenshot 2023-12-05 at 14 50 40

If the target module is not found, it is likely that the registration.php file could not be parsed. In this case, it would be helpful if you could provide the content of the registration.php file, replacing the module name with something like XX_YY if necessary.

But before doing so, you can check if reindexing would help:

Screenshot 2023-12-05 at 14 58 54

Thank you,

norgeindian commented 7 months ago

@bohdan-harniuk, thanks for the detailed explanation. My issue is somehow interesting. The module is properly indexed, but not shown in the dropdown anyway. Reindexing did not change anything. What else could I try?

bohdan-harniuk commented 7 months ago

@norgeindian, could you please capture a screenshot of the steps involved in creating a plugin? Actually, I am interested only in the screenshot of the action that you choose + dialog where you configure it.

norgeindian commented 7 months ago

@bohdan-harniuk , I just checked again and found out, that this action comes from the official Magento plugin and not from your module. I'm terribly sorry.

bohdan-harniuk commented 7 months ago

@norgeindian, you can always generate Magento 2 plugins with Atwix plugin. You should be able to see all the modules here.

  1. open context menu above target method
  2. choose Generate.. action group
  3. choose Before Plugin.../After Plugin.../Around Plugin... action

Alternatively:

  1. set cursor on the target method name
  2. click ⌘N (for MacOS)/Alt+Insert (Windows/Linux)
  3. choose Before Plugin.../After Plugin.../Around Plugin... action

https://github.com/Atwix/phpstorm-plugin-feedback/assets/31848341/68f4ed1d-2c61-48b5-8fac-c8f653f2e1e5

Could you please check it?

Regards,

norgeindian commented 6 months ago

@bohdan-harniuk , thanks for the explanation. That works indeed and there I see all existing modules. Thanks for your help.