js2-mode
js2-mode copied to clipboard
Arrow function in attribute breaks indentation for self-closing tag only
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.
Try this branch https://github.com/wyuenho/rjsx-mode/tree/indent-after-jsx-expr