Scope editor.autoIndent

This commit is contained in:
Ben Ogle
2014-10-06 18:19:07 -07:00
parent 6958e0af10
commit ca4c40936a
2 changed files with 26 additions and 1 deletions

View File

@@ -3241,6 +3241,31 @@ describe "TextEditor", ->
editor.insertText('foo')
expect(editor.indentationForBufferRow(2)).toBe editor.indentationForBufferRow(1) + 1
describe 'when scoped settings are used', ->
coffeeEditor = null
beforeEach ->
waitsForPromise ->
atom.packages.activatePackage('language-coffee-script')
waitsForPromise ->
atom.project.open('coffee.coffee', autoIndent: false).then (o) -> coffeeEditor = o
runs ->
atom.config.set('.source.js', 'editor.autoIndent', true)
atom.config.set('.source.coffee', 'editor.autoIndent', false)
afterEach: ->
atom.packages.deactivatePackages()
atom.packages.unloadPackages()
it "does not auto-indent the line for javascript files", ->
editor.setCursorBufferPosition([1, 30])
editor.insertText("\n")
expect(editor.lineTextForBufferRow(2)).toBe " "
coffeeEditor.setCursorBufferPosition([1, 18])
coffeeEditor.insertText("\n")
expect(coffeeEditor.lineTextForBufferRow(2)).toBe ""
describe "editor.normalizeIndentOnPaste", ->
beforeEach ->
atom.config.set('editor.normalizeIndentOnPaste', true)

View File

@@ -2666,7 +2666,7 @@ class TextEditor extends Model
###
shouldAutoIndent: ->
atom.config.get("editor.autoIndent")
atom.config.get(@getGrammarScopeDescriptor(), "editor.autoIndent")
shouldShowInvisibles: ->
not @mini and atom.config.get(@getGrammarScopeDescriptor(), 'editor.showInvisibles')