how to wrap text in webstorm especially html attributes and arrays and objects

how to get from this:

const [todos, setTodos] = useState([{text:'study the words',key: '1'}, {text:'build the todo app', key: '2'},{text:'go to the gym', key: '3'},]);

to this:

const [todos, setTodos] = useState([
{text:'study the words',key: '1'},
{text:'build the todo app', key: '2'},
{text:'go to the gym', key: '3'},
]);
3 comments
Comment actions Permalink

Set Arrays: to Wrap always in Settings | Editor | Code Style | JavaScript | Wrapping and Braces:

0
Comment actions Permalink
const [todos, setTodos] = useState([
{
text: 'study thee words',
key: '1'
}, {
text: 'build the todo app',
key: '2'
}, {
text: 'go to the gym',
key: '3'
}
]);

done that and how to fix the objects? and also how to keep these settings like on for every project?

also thank you!

0
Comment actions Permalink

For me, the result of formatting is:

const [todos, setTodos] = useState([
{ text: 'study the words', key: '1' },
{ text: 'build the todo app', key: '2' },
{ text: 'go to the gym', key: '3' }
]);

>how to keep these settings like on for every project?

You can modify the default (IDE-wide) code style scheme instead of using the project-local one. see the docs

0

Please sign in to leave a comment.