I work on React-Native in WebStorm.
I have some class, I want use auto import function of WebStorm, It works for some classes, but not for all.
Ctrl + Space
, it does not auto import class.Alt + Enter
also, it has no import suggestion in list.Then I manually imported the class, now WebStorm is not able to show methods suggestion with auto complete, when I press Ctrl + Space
, my methods are not listed there.
Utility.js
export function alertMessage(alertMessage) {
Alert.alert(
"Alert",
alertMessage,
[{ text: "OK", onPress: () => console.log("OK Pressed") }],
{ cancelable: false }
);
}
Is there some setting of WebStorm I am missing. I want to improve my productivity.
You are exporting your function using named export syntax (export function alertMessage()
), but importing it as default, aliasing it to Utility
; the IDE can't know what Utility
is, thus no completion/autoimport is provided. Either change your export to default, or import your function using named import syntax