Trigger a notification when there is a keymap issue

This commit is contained in:
Ben Ogle
2014-11-24 16:29:09 -08:00
parent 362bd2e61a
commit 1f5fa27113
3 changed files with 6 additions and 1 deletions

View File

@@ -20,7 +20,7 @@
"atomShellVersion": "0.19.4",
"dependencies": {
"async": "0.2.6",
"atom-keymap": "^2.2.2",
"atom-keymap": "^2.3.0",
"bootstrap": "git+https://github.com/atom/bootstrap.git#6af81906189f1747fd6c93479e3d998ebe041372",
"clear-cut": "0.4.0",
"coffee-script": "1.7.0",

View File

@@ -249,6 +249,7 @@ class Atom extends Model
@config = new Config({configDirPath, resourcePath})
@keymaps = new KeymapManager({configDirPath, resourcePath})
@keymap = @keymaps # Deprecated
@keymaps.subscribeToFileReadFailure()
@tooltips = new TooltipManager
@notifications = new NotificationManager
@commands = new CommandRegistry

View File

@@ -23,6 +23,10 @@ KeymapManager::loadUserKeymap = ->
if fs.isFileSync(userKeymapPath)
@loadKeymap(userKeymapPath, watch: true, suppressErrors: true)
KeymapManager::subscribeToFileReadFailure = ->
this.onDidFailToReadFile (error) ->
atom.notifications.addError('Failed to load keymap.cson', {detail: error.stack, closable: true})
# This enables command handlers registered via jQuery to call
# `.abortKeyBinding()` on the `jQuery.Event` object passed to the handler.
jQuery.Event::abortKeyBinding = ->