mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Just use the already existing change grammar event.
This commit is contained in:
@@ -136,9 +136,6 @@ class DisplayBuffer extends Model
|
||||
onDidChangeGrammar: (callback) ->
|
||||
@tokenizedBuffer.onDidChangeGrammar(callback)
|
||||
|
||||
onDidUseGrammar: (callback) ->
|
||||
@tokenizedBuffer.onDidUseGrammar(callback)
|
||||
|
||||
onDidTokenize: (callback) ->
|
||||
@tokenizedBuffer.onDidTokenize(callback)
|
||||
|
||||
|
||||
@@ -323,9 +323,6 @@ class TextEditor extends Model
|
||||
onDidChangeGrammar: (callback) ->
|
||||
@emitter.on 'did-change-grammar', callback
|
||||
|
||||
onDidUseGrammar: (callback) ->
|
||||
@displayBuffer.onDidUseGrammar(callback)
|
||||
|
||||
# Extended: Calls your `callback` when the result of {::isModified} changes.
|
||||
#
|
||||
# * `callback` {Function}
|
||||
|
||||
@@ -125,12 +125,8 @@ class TokenizedBuffer extends Model
|
||||
@disposables.add(@configSubscriptions)
|
||||
|
||||
@retokenizeLines()
|
||||
@emitter.emit 'did-use-grammar', grammar
|
||||
@emitter.emit 'did-change-grammar', grammar
|
||||
|
||||
onDidUseGrammar: (callback) ->
|
||||
@emitter.on 'did-use-grammar', callback
|
||||
|
||||
getGrammarSelectionContent: ->
|
||||
@buffer.getTextInRange([[0, 0], [10, 0]])
|
||||
|
||||
|
||||
@@ -550,7 +550,7 @@ class Workspace extends Model
|
||||
@project.bufferForPath(filePath, options).then (buffer) =>
|
||||
editor = @buildTextEditor(_.extend({buffer, largeFileMode}, options))
|
||||
disposable = atom.textEditors.add(editor)
|
||||
grammarSubscription = editor.onDidUseGrammar(@activateGrammar.bind(this))
|
||||
grammarSubscription = editor.onDidChangeGrammar(@activateGrammar.bind(this))
|
||||
editor.onDidDestroy ->
|
||||
grammarSubscription.dispose()
|
||||
disposable.dispose()
|
||||
|
||||
Reference in New Issue
Block a user