           editor.setTextInBufferRange o.range,
             "(#{editor.getTextInBufferRange(o.range)} :: #{type})"
 
-  caseSplitCommand: ({target, detail}) =>
-    editor = target.getModel()
+  caseSplitCommand: ({currentTarget, detail}) =>
+    editor = currentTarget.getModel()
     @upi.withEventRange {editor, detail}, ({crange}) =>
       @process.doCaseSplit(editor.getBuffer(), crange)
       .then (res) ->
         res.forEach ({range, replacement}) ->
           editor.setTextInBufferRange(range, replacement)
 
-  sigFillCommand: ({target, detail}) =>
-    editor = target.getModel()
+  sigFillCommand: ({currentTarget, detail}) =>
+    editor = currentTarget.getModel()
     @upi.withEventRange {editor, detail}, ({crange}) =>
       @process.doSigFill(editor.getBuffer(), crange)
       .then (res) ->

          initialLine: parseInt(line) - 1
          initialColumn: parseInt(col) - 1

  insertImportCommand: ({target, detail}) =>
    editor = target.getModel()
    buffer = editor.getBuffer()
    @upi.withEventRange {editor, detail}, ({crange}) =>
      @process.findSymbolProvidersInBuffer editor, crange

        if t = atom.config.get('haskell-ghc-mod.onSelectionShow')
          @["#{t}Tooltip"] editor, crange

  checkCommand: ({currentTarget}) =>
    editor = currentTarget.getModel()
    @process.doCheckBuffer(editor.getBuffer()).then (res) =>
      @setMessages res, ['error', 'warning']

  lintCommand: ({currentTarget}) =>
    editor = currentTarget.getModel()
    @process.doLintBuffer(editor.getBuffer()).then (res) =>
      @setMessages res, ['lint']

  tooltipCommand: (tooltipfun) =>
    ({currentTarget, detail}) =>
      @upi.showTooltip
        editor: currentTarget.getModel()
        detail: detail
        tooltip: (crange) ->
          tooltipfun currentTarget.getModel(), crange

  insertTypeCommand: ({currentTarget, detail}) =>
    Util = require './util'
    editor = currentTarget.getModel()
    @upi.withEventRange {editor, detail}, ({crange, pos}) =>
      @process.getTypeInBuffer(editor.getBuffer(), crange)
      .then (o) ->
