3

I am coding in Node.js, each time I want to write something that looks like this:

const product = Factory
  .model('App/Models/Product')
  .create()

I get this as an output:

const product = Factory
      .model('App/Models/Product')
      .create()

enter image description here

And I delete back the space before the last line, and then I press Enter to continue coding, the last line jumps right again as this screenshot shows:

enter image description here

Adding (setq-default indent-tabs-mode nil) in my ~/.emacs file does not help.

What settings should I add for my Emacs to avoid this?

7
  • Which mode are you using? Is it js-mode, js2-mode, or something else?
    – user12563
    Commented Mar 5, 2019 at 17:02
  • Yes, I am using js2-mode Commented Mar 5, 2019 at 17:06
  • 1
    Indentation in js2-mode is controlled by js-mode, and it seems that I can't get it to not give special indentation to chained calls. Maybe someone reported a problem with this before to either js-mode or js2-mode maintainers.
    – user12563
    Commented Mar 5, 2019 at 17:11
  • Interesting feedback, thank you, I will investigate more about it Commented Mar 5, 2019 at 17:24
  • try changing indent level in C-h v js-chain-indent
    – A_P
    Commented Mar 5, 2019 at 19:55

1 Answer 1

0

It is simpler than i thought. I use the same solution I used here and it worked: How do I set up indentation to 2 spaces in web-mode

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.