问题
I have recently uninstalled (also deleted PhpStorm ~/Library/*/PhpStorm2019.1 files) and reinstalled the IDE (2019.1.2) from scratch. I am on a Mac with Mojave 10.14.5. This was due to the fact the Material Theme UI screwed up my themes.
When I started working and noticed that my beloved initialize fields option is no longer showing. I've been using initialize fields for a very long time and I can't explain what is causing it not to show. The whole context menu is not showing at all.
I'm referencing the below Question and Answer link because this is explaining exactly how I've been using the init fields option. How to automatically generate parameter assignations in class constructors in PhpStorm?
Am I doing something wrong?
回答1:
The issue occurs when a portion of the application code (ex: vendor/app_modules) is added to the Excluded Directories list (Preferences | Directories). This causes the inspections functionality, amongst others (for example unused use
statements are no longer highlighted with grey, phpmd, phpcs notices and warnings are no longer displayed, sonarlint no longer shows analysis on the current file) to stop working as expected.
In my case the vendor modules were automatically added to the Excluded Directories list because of the directives defined in the .gitignore file (this happens when the project is created in PhpStorm).
# .gitignore file sample directive
vendor/
After removing each entry from the excluded list the inspections, phpmd and phpcs warnings, sonarlint analysis and everything else start working again.
来源:https://stackoverflow.com/questions/56401258/phpstorm-initialize-fields-context-menu-not-showing