mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Cache the editor.tabLength config value
This commit is contained in:
@@ -82,13 +82,17 @@ class TokenizedBuffer extends Model
|
||||
@grammarScopeDescriptor = [@grammar.scopeName]
|
||||
@currentGrammarScore = score ? grammar.getScore(@buffer.getPath(), @buffer.getText())
|
||||
@subscribe @grammar.onDidUpdate => @retokenizeLines()
|
||||
@retokenizeLines()
|
||||
|
||||
@configSettings = tabLength: atom.config.get(@grammarScopeDescriptor, 'editor.tabLength')
|
||||
|
||||
@grammarTabLengthSubscription?.dispose()
|
||||
@grammarTabLengthSubscription = atom.config.onDidChange @grammarScopeDescriptor, 'editor.tabLength', =>
|
||||
@grammarTabLengthSubscription = atom.config.onDidChange @grammarScopeDescriptor, 'editor.tabLength', ({newValue}) =>
|
||||
@configSettings.tabLength = newValue
|
||||
@retokenizeLines()
|
||||
@subscribe @grammarTabLengthSubscription
|
||||
|
||||
@retokenizeLines()
|
||||
|
||||
@emit 'grammar-changed', grammar
|
||||
@emitter.emit 'did-change-grammar', grammar
|
||||
|
||||
@@ -118,7 +122,7 @@ class TokenizedBuffer extends Model
|
||||
@tokenizeInBackground() if @visible
|
||||
|
||||
getTabLength: ->
|
||||
@tabLength ? atom.config.get(@grammarScopeDescriptor, 'editor.tabLength')
|
||||
@tabLength ? @configSettings.tabLength
|
||||
|
||||
setTabLength: (@tabLength) ->
|
||||
@retokenizeLines()
|
||||
|
||||
Reference in New Issue
Block a user