felipeochoa / rjsx-mode

A JSX major mode for Emacs
https://github.com/felipeochoa/rjsx-mode
MIT License
641 stars 32 forks source link

Indentation? #87

Closed cinjon closed 5 years ago

cinjon commented 6 years ago

I'm using emacs 25.3.1 and just added rjsx-mode thinking that it would solve my indentation issues. However, I'm still running into the following problem where the indentation in the render return is terrible. Any ideas on how to fix this?

import React from 'react';
import { Component } from 'react'
import { dataActions } from '../../actions';
import Page from '../../components/Page';
import Footer from '../../components/Footer';
...

class MyClass extends Component {
    state = {
        myKey: "value"
    }

    ....
    <everything is good indentation wise>
    ...

    render() {
        let motion = this.props.user;
        if (!user) {
            return null;
        }

        return (
            <Page>
            <h1>Foo</h1>
            <div>
            <Container>
            <h1>Bar</h1>
            </Container>
            </div>
            </Page>
         );
    }
}
...

Some relevant parts of my spacemacs:

   dotspacemacs-configuration-layers
   '(
     ruby
     yaml
     javascript
     python
     markdown
     ivy
     emacs-lisp
     react
     )

dotspacemacs-additional-packages '(rjsx-mode)

(defun dotspacemacs/user-config ()
  (add-to-list 'auto-mode-alist '("components\\/.*\\.js\\'" . rjsx-mode))

  ;; Show 80-column marker
  (define-globalized-minor-mode global-fci-mode fci-mode (lambda () (fci-mode 1)))
  (global-fci-mode 1)
  )
cinjon commented 6 years ago

Note also that commenting out the "react" configuration layer and reloading does not visibly change anything.

felipeochoa commented 6 years ago

What version of rjsx mode are you using? I don't know much about spacemacs, but can you try reproducing with an emacs -q session? If so can you post a small test case here?

cinjon commented 6 years ago

Package version: 20180913.2224. I just tried it with emacs -q and it was the same. I'll try posting a smaller version later, have to jet rn.

felipeochoa commented 6 years ago

Ok will wait for repro case

wyuenho commented 5 years ago

I can't reprod this on emacs 26.1 and latest rjsx-mode

felipeochoa commented 5 years ago

Please reopen if still causing issues