mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Propagate a did-use-grammar event out of the tokenized buffer.
This commit is contained in:
@@ -137,6 +137,9 @@ class DisplayBuffer extends Model
|
||||
onDidChangeGrammar: (callback) ->
|
||||
@tokenizedBuffer.onDidChangeGrammar(callback)
|
||||
|
||||
onDidUseGrammar: (callback) ->
|
||||
@tokenizedBuffer.onDidUseGrammar(callback)
|
||||
|
||||
onDidTokenize: (callback) ->
|
||||
@tokenizedBuffer.onDidTokenize(callback)
|
||||
|
||||
|
||||
@@ -325,6 +325,9 @@ 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}
|
||||
|
||||
@@ -126,9 +126,12 @@ class TokenizedBuffer extends Model
|
||||
@disposables.add(@configSubscriptions)
|
||||
|
||||
@retokenizeLines()
|
||||
@packageManager.triggerActivationHook("#{grammar.packageName}:grammar-used")
|
||||
@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]])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user