       'open-in-vim': => @openInVim()
       'generate-introspection-report': => @generateIntrospectionReport()
       'generate-command-summary-table': => @generateCommandSummaryTable()
-      'toggle-dev-environment': => @toggleDevEnvironment()
       'clear-debug-output': => @clearDebugOutput()
-      'reload-packages': => @reloadPackages()
-      'toggle-reload-packages-on-save': => @toggleReloadPackagesOnSave()
+      'reload': => @reload()
+      'reload-with-dependencies': => @reload(true)
       'report-total-marker-count': => @getAllMarkerCount()
       'report-total-and-per-editor-marker-count': => @getAllMarkerCount(true)
 

      ]
      recursiveInspect: Base

class DevEnvironment
  constructor: (@editor) ->
    @editorElement = @editor.element
    @emitter = new Emitter
    fileName = path.basename(@editor.getPath())
    @disposable = @editor.onDidSave =>
      console.clear()
      Base.suppressWarning = true
      @reload()
      Base.suppressWarning = false
      Base.reset()
      @emitter.emit 'did-reload'
      console.log "reloaded #{fileName}"

  dispose: ->
    @disposable?.dispose()

  onDidReload: (fn) -> @emitter.on('did-reload', fn)

  reload: ->
    packPath = atom.packages.resolvePackagePath('vim-mode-plus')
    originalRequire = global.require
    global.require = (libPath) ->
      if libPath.startsWith './'
        originalRequire "#{packPath}/lib/#{libPath}"
      else
        originalRequire libPath

    atom.commands.dispatch(@editorElement, 'run-in-atom:run-in-atom')
    global.require = originalRequire

module.exports = Developer


packageScope = 'vim-mode-plus'
getEditorState = null

invalidateRequireCacheForPackage = (packPath) ->
  Object.keys(require.cache)
    .filter (p) -> p.startsWith(packPath + path.sep)
    .forEach (p) -> delete require.cache[p]

class Developer
  init: (service) ->
