Assign keymaps in Atom environment constructor

This commit is contained in:
Nathan Sobo
2015-09-28 13:26:10 -06:00
parent 88d80b1c97
commit 68b9512da0
2 changed files with 7 additions and 5 deletions

View File

@@ -168,6 +168,10 @@ class Atom extends Model
Config = require './config'
@config = new Config({configDirPath, resourcePath, notificationManager: @notifications})
KeymapManager = require './keymap-extensions'
@keymaps = new KeymapManager({configDirPath, resourcePath, notificationManager: @notifications})
reset: ->
@config.reset()
@@ -204,7 +208,6 @@ class Atom extends Model
@loadTime = null
KeymapManager = require './keymap-extensions'
ViewRegistry = require './view-registry'
CommandRegistry = require './command-registry'
TooltipManager = require './tooltip-manager'
@@ -227,7 +230,6 @@ class Atom extends Model
# Make react.js faster
process.env.NODE_ENV ?= 'production' unless devMode
@keymaps = new KeymapManager({configDirPath, resourcePath})
@keymaps.subscribeToFileReadFailure()
@tooltips = new TooltipManager
@commands = new CommandRegistry

View File

@@ -41,11 +41,11 @@ KeymapManager::loadUserKeymap = ->
[this document][watches] for more info.
[watches]:https://github.com/atom/atom/blob/master/docs/build-instructions/linux.md#typeerror-unable-to-watch-path
"""
atom.notifications.addError(message, {dismissable: true})
@notificationManager.addError(message, {dismissable: true})
else
detail = error.path
stack = error.stack
atom.notifications.addFatalError(error.message, {detail, stack, dismissable: true})
@notificationManager.addFatalError(error.message, {detail, stack, dismissable: true})
KeymapManager::subscribeToFileReadFailure = ->
@onDidFailToReadFile (error) =>
@@ -57,6 +57,6 @@ KeymapManager::subscribeToFileReadFailure = ->
else
error.message
atom.notifications.addError(message, {detail, dismissable: true})
@notificationManager.addError(message, {detail, dismissable: true})
module.exports = KeymapManager