Format React Components
I am trying to figure a work around to the way the Code Formatter formats React components.
For example this code from my App.js:
render() {
return (
<div>
<Header currentUser={this.state.currentUser} />
<Switch>
<Route exact path='/' component={HomePage} />
<Route path='/shop' component={ShopPage} />
<Route path='/signin' component={SignIn} />
</Switch>
</div>
);
}
When I use the coee formattor is reconfigured to:
render() {
return (
<div>
<Header currentUser={this.state.currentUser} /> <Switch> <Route exact path='/' component={HomePage} /> <Route
path='/shop' component={ShopPage} /> <Route path='/signin' component={SignIn} /> </Switch>
</div>
);
}
Is there a setting that would help with this mess?
请先登录再写评论。
JSX tags are treated as 'inline' and thus aren't wrapped (https://youtrack.jetbrains.com/issue/WEB-37966)
Enabling Keep line breaks in text in Settings | Editor | Code Style | HTML | Other should preserve existing line breaks on reformatting
That worked thanks. I am really impressed how fast questions are responded.
You have saved me so much headache. I've been scouring for this all day—boy was it ANNOYING. Thank you!