Add an event for after the user keymap has loaded.

This commit is contained in:
Ian Olsen
2017-01-05 10:49:09 -08:00
parent 5a898b2ec4
commit 8d212b10d4

View File

@@ -8,6 +8,9 @@ bundledKeymaps = require('../package.json')?._atomKeymaps
KeymapManager::onDidLoadBundledKeymaps = (callback) ->
@emitter.on 'did-load-bundled-keymaps', callback
KeymapManager::onDidLoadUserKeymap = (callback) ->
@emitter.on 'did-load-user-keymap', callback
KeymapManager::loadBundledKeymaps = ->
keymapsPath = path.join(@resourcePath, 'keymaps')
if bundledKeymaps?
@@ -32,8 +35,10 @@ KeymapManager::loadUserKeymap = ->
return unless fs.isFileSync(userKeymapPath)
try
errorLoading = false
@loadKeymap(userKeymapPath, watch: true, suppressErrors: true, priority: 100)
catch error
errorLoading = true
if error.message.indexOf('Unable to watch path') > -1
message = """
Unable to watch path: `#{path.basename(userKeymapPath)}`. Make sure you
@@ -49,6 +54,9 @@ KeymapManager::loadUserKeymap = ->
stack = error.stack
@notificationManager.addFatalError(error.message, {detail, stack, dismissable: true})
@emitter.emit 'did-load-user-keymap' unless errorLoading
KeymapManager::subscribeToFileReadFailure = ->
@onDidFailToReadFile (error) =>
userKeymapPath = @getUserKeymapPath()