JS auto-import and completion of non-JS imports
In my web app (JavaScript, TypeScript, Webpack) I often import non-code assets, such as SVGs:
import MyIconSVG from "../../assets/icons/my-icon.svg"
However, unlike JS imports, IntelliJ:
1. Cannot generate the import by suggestion, ie typing "my-icon" somewhere
2. Cannot suggest the file at the end of the path, even though it can complete the path leading up to it
Can this be enabled in IntelliJ IDEA?
Please sign in to leave a comment.
No, such auto-imports are not supported. Auto-imports only work for JS/TS modules
What about file completion? Basically so that typing "../assets/icons/my" would suggest "my-icon.svg" for completion?
isn't it available? When hitting Ctrl+Space within `""`, I can see all files in completion list, including images:
It isn't... maybe it's a specific issue with TS auto-completion?
Screenshot in my previous reply is taken when editing Typescript file
Unfortunately this is what I get:
There are a whole bunch of .svg files in that folder, but it can't suggest or auto-complete them.
It can suggest and auto-complete the folders as usual:
Try hitting Ctrl+Space twice
Unfortunately that didn't seem to work
Have the same issue and reeeally want autocompletion for image paths in js/ts files.
Please vote for https://youtrack.jetbrains.com/issue/WEB-32138