mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Only add view when grammars-loaded event fires
Previously the views would be added immediately if more than one grammar was already registered. This was unneeded since the event will always fire after the package is activated.
This commit is contained in:
@@ -9,10 +9,10 @@ module.exports =
|
||||
]
|
||||
|
||||
activate: ->
|
||||
if syntax.grammars.length > 1
|
||||
@subscribeToEditors()
|
||||
else
|
||||
syntax.on 'grammars-loaded', => @subscribeToEditors()
|
||||
syntax.on 'grammars-loaded.spell-check', => @subscribeToEditors()
|
||||
|
||||
deactivate: ->
|
||||
syntax.off '.spell-check'
|
||||
|
||||
subscribeToEditors: ->
|
||||
rootView.eachEditor (editor) ->
|
||||
|
||||
@@ -8,6 +8,7 @@ describe "Spell check", ->
|
||||
rootView.open('sample.js')
|
||||
config.set('spell-check.grammars', [])
|
||||
window.loadPackage('spell-check', activateImmediately: true)
|
||||
syntax.trigger 'grammars-loaded'
|
||||
rootView.attachToDom()
|
||||
editor = rootView.getActiveView()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user