From b1301a5f7416236a99cbe6203c91284f7d486355 Mon Sep 17 00:00:00 2001 From: joshaber Date: Mon, 25 Apr 2016 14:50:34 -0400 Subject: [PATCH] Trigger the activation hook outside the text editor. --- src/workspace.coffee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/workspace.coffee b/src/workspace.coffee index 838a1dcec..a54ace2a2 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -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.