       selection = _.first @editor.selectWord()
       return unless selection
 
-      @adjustSelectionForDot(selection)
-
-      selection.insertText(match.completion)
-      @editor.selectWord()
+      @insertMatch(match)
 
   selectNextItemView: ->
     super

    super
    false

  adjustSelectionForDot: (selection) ->
    if selection.getText()[0] == '.'
      rng = selection.getBufferRange()
      rng.start = rng.start.translate({ column: 1 })
      selection.setBufferRange(rng)

    @subscribe editorView, 'dart-tools:autocomplete', =>
      @attach()

      path = @editor.getPath()
      pos = @editor.getCursorBufferPosition()
      offset = @editor.buffer.characterIndexForPosition(pos)

      console.log 'autocompleting at', offset

      @showFetchingResults()
      @api.updateFile @editor.getPath(), @editor.getText()
