Frage

I am using Emacs and js3-mode to edit some javascript code. After I write the following code and indent it, I see this:

var returnValue = someFunction(function () {
                     console.log('This is a callback');
                  });

What I want is this:

var returnValue = someFunction(function () {
  console.log('This is a callback');
});

It looks like js3-mode is trying to align the callback with the call to someFunction, but I don't want that. How do I change the indentation style?

Side note: That code was just an example, it's not actually the code I'm editing, but the situation is similar.

War es hilfreich?

Lösung

From js3-mode wiki, add this to you init file

(setq js3-consistent-level-indent-inner-bracket t)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top