atom/atom — pull request #3718 by benogle (2014-10-03 19:30:44+00:00)
Title: Add scoped settings to user config

status: WIP: opening super early again.

Building on https://github.com/atom/atom/issues/3674, the plan is to allow for scoped configuration of editor settings. This solves the problem of "I only want to soft wrap in markdown documents", "I need hard tabs for make", "I want 2 space tabs for ruby and 4 space tabs for python", etc.

### The settings

```coffee
# Scoping these is obvious to me
editor.softTabs
editor.tabLength
editor.softWrap
editor.softWrapAtPreferredLineLength
editor.showInvisibles
editor.showIndentGuide
editor.nonWordCharacters

# Scoping these seems good, but maybe not
editor.invisibles
editor.autoIndent
editor.normalizeIndentOnPaste
```

Language packages will be able to set these settings in their `scoped-properties` cson files.

Comment if you have suggestions about settings that should / should not be scoped.

### User config file format

The user will also be able to override these settings in their config file. The plan right now is to place all the current settings under a `global` key, then any overridden scoped settings under their scope. Check it:

```coffee
'global':
'editor':
'fontSize': 14
'fontFamily': 'monaco'
'tabLength': 4
'core':
'themes': [
'atom-light-ui'
'atom-light-syntax'
]
'.source.gfm':
'softWrap': true
'.source.gfm .code':
'softWrap': false
'.source.ruby':
'tabLength': 2
```

In this example, all languages other than ruby will use 4 space tabs, and ruby will use 2. Additionally, markdown files will be wrapped. One neat thing, because of scoping, is that code blocks in markdown will _not_ be wrapped in this case.

### Backward compatibility

The config file will be read in as it is today. It will check for a `global` key, and if not there assume the old format. Upon writing the file back out, it will write out with global config under the `global` key.

Refs https://github.com/atom/atom/issues/2593, https://github.com/atom/language-make/issues/3, https://github.com/atom/atom/pull/2917
Depends on https://github.com/atom/atom/pull/3697