       'learn-ide:save-all': @unimplemented
 
     @disposables.add atom.workspace.observeTextEditors (editor) =>
-      editor.onDidSave(@onEditorSave)
+      editor.onDidSave (e) =>
+        @onEditorSave(e)
+        @updateTitle()
 
     @disposables.add atom.packages.onDidActivatePackage (pkg) =>
       return unless pkg.name is 'find-and-replace'

module.exports =
class AtomHelper
  constructor: (@virtualFileSystem) ->
    @addKeymaps()
    @addMenu()
    @addContextMenus()
    atom.packages.onDidActivateInitialPackages(@handleEvents)

  handleEvents: =>


      @disposables.add resultModel.onDidReplacePath ({filePath}) =>
        @saveAfterProjectReplace(filePath)

    @disposables.add @package().onDidDeactivate =>
      atom.workspace.updateWindowTitle = LocalStorage.getItem('workspace:updateTitle')
      LocalStorage.removeItem('workspace:updateTitle')
      @disposables.dispose()

  replaceTitleUpdater: ->
    if not LocalStorage.getItem('workspace:updateTitle')
      LocalStorage.setItem('workspace:updateTitle', atom.workspace.updateWindowTitle)
      atom.workspace.updateWindowTitle = @updateTitle

  updateTitle: =>
    itemPath = atom.workspace.getActivePaneItem()?.getPath?()

    node =
      if itemPath?
        @virtualFileSystem.getNode(itemPath)
      else
        @virtualFileSystem.projectNode

    title =
      if node? and node.path?
        "Learn IDE — #{node.path.replace(/^\//, '')}"
      else
        'Learn IDE'

    document.title = title
    atom.applicationDelegate.setRepresentedFilename(node.localPath())

  configPath: ->
    atom.configDirPath
