     else
       atom.workspace.saveActivePaneItemAs()
 
-  typecheckFile: ({ target }) =>
-    # the file needs to be saved for typechecking
-    @saveFile target.model
-    uri = target.model.getURI()
+  typecheckFile: (event) =>
+    editor = @getEditor()
+    @saveFile editor
+    uri = editor.getURI()
     @messages.setTitle 'Idris: Typechecking...'
     @messages.clear()
 

      .subscribe successHandler, @displayErrors

  doMakeCase: ({ target }) =>
    editor = target.model
    @saveFile editor
    uri = editor.getURI()
    line = editor.getLastCursor().getBufferRow()
    word = @getWordUnderCursor target

    successHandler = ({ responseType, msg }) ->
      [clause] = msg

      .subscribe successHandler, @displayErrors

  doProofSearch: ({ target }) =>
    editor = getEditor()
    @saveFile editor
    uri = editor.getURI()
    line = editor.getLastCursor().getBufferRow()
    word = @getWordUnderCursor editor

    successHandler = ({ responseType, msg }) ->
      [res] = msg
