How to improve auto indentation?


#1

Hello! I would like to learn how the auto indentation is calculated by the editor. Being new to Atom, I am currently having trouble finding any documentation related to this feature.

One of the specific situations I curious about improving is the auto indentation of JavaScript method chains.

Below is an example of how they are currently auto indented.

const newValue$ = domSource()
.selectx('.slider')
.events('input')
.map(ev => ev.target.value)

Though how can I accomplish the following?

const newValue$ = domSource()
  .selectx('.slider)`
  .events('input')
  .map(ev => ev.target.value)`

I’ve noticed if the first method in the chain is manually indented, those that follow will be indented to the same column, though if the entire file is auto indented it will all be reset.


#2

Indentation is calculated by the editor based on the language’s settings. Here are the settings for JavaScript. There are two regular expressions, one which increases the indent when matched and one which decreases the indent.


#3

How would I be able to modify that setting?


#4

Any language-specific setting can be overridden by the user in their config.cson.