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

Wrong indentation with no parens and no semicolon #130

Open
ezmiller opened this issue Aug 3, 2021 · 2 comments
Open

Wrong indentation with no parens and no semicolon #130

ezmiller opened this issue Aug 3, 2021 · 2 comments

Comments

@ezmiller
Copy link

ezmiller commented Aug 3, 2021

I think this may be a bug. I am seeing the following behavior when writing jsx without parens and no semicolons:

const Component = <div>Hello World</div>
      const foo = 'foo'

It should not be indented:

const Component = <div>Hello World</div>
const foo = 'foo'
@felipeochoa
Copy link
Owner

Hmm, it does not reproduce on my end; I get the correct indentation. Can you provide the whole file?

@nawetimebomb
Copy link

I think this is a common Emacs "issue". Not really an issue but how Emacs behave on indenting stuff with any mode as I have seem a similar behavior on cc-mode before. What I mean is, it's probably more related to electric-indent-mode than rjsx-mode.

It happens to me but as soon as I press TAB or RET on the second line, it will correct the indentation. You could probably add a hook to before-save-hook to new-line-and-indent.

(add-hook 'before-save-hook #'new-line-and-indent)

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

No branches or pull requests

3 participants