     @messages.clear()
     @messages?.close()
     @messages = null
-
-    @markersOfFile = null
-    @editors = null
-
-    @disposables.dispose()

{MessagePanelView, LineMessageView} = require 'atom-message-panel'
_ = require 'lodash'
{log, isScalaSource} = require '../utils'
{CompositeDisposable} = require 'atom'

# TODO: Add a map from file -> array[messages] and editor subs
module.exports =
class TypeChecking


  constructor: ->
    @messages = new MessagePanelView
      title: 'Ensime'
    @messages.attach()

    @disposables = new CompositeDisposable

    @editors = new Map

    @markersOfFile = new Map

    @disposables.add atom.workspace.observeTextEditors (editor) =>
      if isScalaSource(editor) # TODO: check that the source is also in an ensime-activated project.  ensime:start should log which directories are ensime-enabled
        @editors.set(editor.getPath(), editor)
        @disposables.add editor.onDidDestroy () =>
          @editors.delete(editor.getPath())

  hide: ->
    @messages.hide()

  show: ->
    @messages.show()

  addScalaNotes: (msg) ->
    notes = msg.notes

      if(not file.includes('dep-src')) # TODO: put under flag
        addNoteToMessageView note for note in notes


  clearScalaNotes: ->
    @messages.clear()
