danday74 danday74 - 1 month ago 11
React JSX Question

WebStorm auto import not working when pasting

I've got a React component as follows:

<CodeMirrorReact onChange={onChangeTest} code={multiLineCode}></CodeMirrorReact>

When I start typing ...
... a drop down appears. I can select the component from the dropdown and WebStorm auto completes for me AND (more importantly) does an auto import for the component by adding the following import statement:

import CodeMirrorReact from '../CodeMirrorReact/index'


However, when I copy and paste the above component code, WebStorm does not do the auto import. Ctrl + Enter does not work either.

Anyone know how to fix it so auto imports work when pasting?

Answer Source

Auto import on paste is not a feature of the stable version of WebStorm.

However it has been added to the WebStorm EAP for the next version (2017.3).