Auto-import unreliable
Since the latest update to PhpStorm (2017.3.6), the ability to automatically add imports seems to be very unreliable.
As an example, i've just ran "npm install --save amazing-time-picker", and i'm trying to add the module to my Angular imports, but PHPstorm doesn't seem to know about it:
https://gyazo.com/50cb369672f291acb98e01586cddcc14
This is a particularly annoying regression. Is this a known issue? Does anyone know of a workaround?
请先登录再写评论。
It seems that PhpStorm doesn't know about this module yet.
Can you find it with Find in Path? And does it stay that way after 1) File | Synchronize 2) File | Invalidate Caches / Restart?
Yes, the module is there, I can add the import manually and it works fine:
File | Synchronize didn't work, neither did File | invalidate Caches / Restart.
It does seem that PHPstorm knows about the module, since I get autocomplete when manually adding the import:
https://gyazo.com/79707f97745baa053ab8d9f0703a7dd6
Works fine for me in 2017.3.6:
Do you have the corresponding node_module included in project? Please expand node_modules folder in the Project tool window, scroll down so that amazing-time-picker folder is visible and take a screenshot
Thanks for your help. (I'm also running 2017.3.6). Here you go:
https://gyazo.com/08b567045875dbe638eae9aa6992e059
Thanks. Just as I expected: the module is excluded completely, just as all other node_modules. You must have deleted/disabled <project_name>/node_modules library from Settings | Languages & Frameworks | JavaScript | Libraries... You can't expect auto-import to work for excluded modules. Note that you will also lose Angular support - it can only work if @angular modules are included.
Hmm, I really didn't remove it from there.
I may have accidentally marked it as not excluded and then excluded it again, however - would this remove that entry?
How can I add it back?
If you do have the corresponding library in Settings | Languages & Frameworks | JavaScript | Libraries, just enable it. If it's not there, you have to create it manually - press Add.. button and add those modules you'd like getting the completion from. Normally these are modules listed in your project "dependencies": {} in package.json