Retokenize when setTabLength() was called.

This commit is contained in:
Ben Ogle 2014-10-06 14:13:28 -07:00
parent 8cd217e50a
commit 857fd5eaf4
2 changed files with 10 additions and 1 deletions

View File

@ -3057,7 +3057,15 @@ describe "TextEditor", ->
coffeeEditor.setCursorBufferPosition [0, 10]
expect(coffeeEditor.getTabLength(coffeeEditor.scopesAtCursor())).toBe 4
it 'will retokenize when the tab length is updated', ->
it 'will retokenize when the tab length is updated via .setTabLength()', ->
expect(editor.getTabLength()).toBe 2
expect(editor.tokenizedLineForScreenRow(5).tokens[0].firstNonWhitespaceIndex).toBe 2
editor.setTabLength(6)
expect(editor.getTabLength()).toBe 6
expect(editor.tokenizedLineForScreenRow(5).tokens[0].firstNonWhitespaceIndex).toBe 6
it 'will retokenize when the editor.tabLength setting is updated', ->
expect(editor.getTabLength()).toBe 2
expect(editor.tokenizedLineForScreenRow(5).tokens[0].firstNonWhitespaceIndex).toBe 2

View File

@ -117,6 +117,7 @@ class TokenizedBuffer extends Model
@tabLength ? atom.config.get(scopeDescriptor ? @grammarScopeDescriptor, 'editor.tabLength')
setTabLength: (@tabLength) ->
@retokenizeLines()
setInvisibles: (invisibles) ->
unless _.isEqual(invisibles, @invisibles)