Wrap always option not working for single imports
Answered
The Javascript code style ES6 import/export "Wrap Always" option is not working for single imports as it still puts them on one line.
Please sign in to leave a comment.
Hi Thomas,
What version of the IDE do you use?
Please provide a sample file where this can be reproduced.
Please also check to make sure it is not caused by custom .editorconfig files.
Hi Arina,
We are using IntelliI IDEA 2022.1.1 (Ultimate Edition).
An example of code which causes this issue is:
import {
Thing
} from "foo";
const thing = Thing();
which becomes the following when formatting on save:
import {Thing} from "foo";
const thing = Thing();
But "Wrap Always" is set so it shouldn't have done that.
I don't think any of the options we have in our .editorconfig will affect imports, also changing the ES6 import/export option does make a difference because for 2 or more imports it stays wrapped, for example:
import {
Thing1
Thing2
} from "foo";
const thing1 = Thing1();
const thing2 = Thing2();
stays like that, so I don't think it is external configuration (like .editorconfig) causing issues.
Hi Thomas,
I couldn't reproduce the problem. For me, single import from your example stays as it is when formatted. I use the default code style schema for JavaScript.
You can try restoring your current settings to defaults via File | Manage IDE Settings | Restore Default Settings
Alternatively, you can import the default schema file to reset only the code style settings. The file can be obtained e.g. in a new side-by-side installation of the IDE under File | Settings | Editor | Code Style: