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

Arrow function in attribute breaks indentation for self-closing tag only #489

Open
alvarocaceresmunoz opened this issue Mar 14, 2018 · 1 comment

Comments

@alvarocaceresmunoz
Copy link

I am an Emacs newbie using rjsx-mode to edit .js files using React Native. This may not be the place to ask for this, in which case I am sorry for any inconvenience.

In the following example, and after applying indent-region using the rjsx-mode, I get:

class MyClass {
    render() {
        return(
            <form>
              <input value={x => '1'}/>
                <input value='2'/>
                <input value={x => '3'}/>
                  <input value={x => '4'}></input>
                  <input value='5'/>
            </form>
        );
    }
}

Where I should get something like:

class MyClass {
    render() {
        return(
            <form>
              <input value={x => '1'}/>
              <input value='2'/>
              <input value={x => '3'}/>
              <input value={x => '4'}></input>
              <input value='5'/>
            </form>
        );
    }
}

I first thought this had to do with rjsx-mode, but their repo says that indentation issues have to do with js2-mode. In any case, I have included the output of the describe-mode command in case it helps:

Enabled minor modes: Auto-Composition Auto-Compression Auto-Encryption
Blink-Cursor Completion-In-Region Cursor-Sensor Electric-Indent
Electric-Pair Evil Evil-Local File-Name-Shadow Font-Lock
Global-Auto-Revert Global-Eldoc Global-Font-Lock Global-Hl-Line
Global-Nlinum Global-Undo-Tree Line-Number Mouse-Wheel Nlinum
Rainbow-Delimiters Shell-Dirtrack Tooltip Transient-Mark Undo-Tree

(Information about these minor modes follows the major mode info.)

RJSX mode defined in ‘rjsx-mode.el’:
Major mode for editing JSX files.

In addition to any hooks its parent mode ‘js2-jsx-mode’ might have run,
this mode runs the hook ‘rjsx-mode-hook’, as the final step
during initialization.

Any ideas on why would this happen? Thank you.

@wyuenho
Copy link
Contributor

wyuenho commented May 17, 2018

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

2 participants