Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSX not formatted correctly #34

Closed
aikeru opened this issue Feb 28, 2017 · 5 comments
Closed

JSX not formatted correctly #34

aikeru opened this issue Feb 28, 2017 · 5 comments
Labels

Comments

@aikeru
Copy link

aikeru commented Feb 28, 2017

Other editors like WebStorm and VSCode seem to format/understand a fat arrow expression, followed by linebreak, followed by a JSX tag, but rjsx-mode seems to trip on this.
IE:

const Bar = () =>
  <div>
    //add a new tag here/hit enter and it is put at the same indentation as div
  </div>

Thanks for your excellent work on this mode! I've definitely seen an improvement over the react layer already.

@aikeru
Copy link
Author

aikeru commented Feb 28, 2017

It works fine if wrapping the JSX with parens

const Bar = () => (
  <div>
    //add a new tag here and expect it to be formatted correctly
  </div>
)

But as this is valid syntax and other tools work fine with it, maybe there is a way rjsx-mode can support it too? :)

@aikeru
Copy link
Author

aikeru commented Feb 28, 2017

Also I would expect when pressing "enter" / "return" after the JSX for the cursor to move to the beginning of the next line. Instead, it continues on the same line.

@felipeochoa
Copy link
Owner

This is an indentation problem. To quote the README:

Note: This mode does not add any indentation improvements to the one built into js-mode. Please report all identation bugs there

@aikeru
Copy link
Author

aikeru commented Feb 28, 2017

@felipeochoa apologies and thanks for the response

@felipeochoa
Copy link
Owner

@aikeru, no problem! I find the indentation situation a bit frustrating as well, but haven't been frustrated enough to actually fix it! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants