Trigger the activation hook outside the text editor.

This commit is contained in:
joshaber
2016-04-25 14:50:34 -04:00
parent e8a4f38c69
commit b1301a5f74

View File

@@ -550,9 +550,15 @@ class Workspace extends Model
@project.bufferForPath(filePath, options).then (buffer) =>
editor = @buildTextEditor(_.extend({buffer, largeFileMode}, options))
disposable = atom.textEditors.add(editor)
editor.onDidDestroy -> disposable.dispose()
grammarSubscription = editor.onDidUseGrammar(@handleDidUseGrammar.bind(this))
editor.onDidDestroy ->
grammarSubscription.dispose()
disposable.dispose()
editor
handleDidUseGrammar: (grammar) ->
@packageManager.triggerActivationHook("#{grammar.packageName}:grammar-used")
# Public: Returns a {Boolean} that is `true` if `object` is a `TextEditor`.
#
# * `object` An {Object} you want to perform the check against.