I'm using spacemacs for react development. i like it mostly but I have one issue that is annoying. Currently emacs will try to align certain lines with the last opening paren, so something like this:

return React.createElement('div', 
                          { class = "className" }

I would rather the second line not be aligned with the opening paren and instead be indented only one extra 'tab' deep. So something like this:

return React.createElement('div',
    { class = "className" }

I believe my problem is only if I'm stating a new block on the next line, ie I have an opening brace/bracket/paren as the first character on my second line. For instance I get the indentation I expect if I do this:

return React.createElement('div', {
    class = "className",
    style = "whatever",

I'm not very experienced with eclipse configuration, I've stolen a mostly configured version for a peer so far. I have tried following these instructions: https://stackoverflow.com/questions/1475279/how-to-control-indentation-after-an-open-parenthesis-in-emacs but they didn't change anything, presumably because I should be setting a different argument to control indentation for opening brackets, though I'm not sure what argument I need.

React-mode seems to use mostly default settings for indentation, I used standard-indent for instance to control indent size, so presumably it's using whatever the default settings are for controlling indentation as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.