       @css(left: left, top: potentialTop, bottom: 'inherit')
 
   confirmed: (item) ->
-    {replacementOffset} = @autocompleteInfo.params
-    {buffer} = @editor
-    {selectionOffset} = item
-
     @cancel()
 
-    startPos = buffer.positionForCharacterIndex(replacementOffset)
-    endPos   = buffer.positionForCharacterIndex(replacementOffset + selectionOffset)
-    range    = new Range(startPos, endPos)
-
-    # TODO: replace when analysis_server is fixed (?)
-    # Or I might be using it wrong. Whatever.
-    # if replacementOffset were accurate, we'd use the following:
-    # @editor.setTextInBufferRange range, item.completion
-    # instead, we make a gamble that all completions are word-based:
-    selection = _.first @editor.selectWord()
-    @adjustSelectionForDot(selection)
-    selection?.insertText(item.completion)
+    @insertMatch(item)
 
   cancelled: ->
     super

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

      selection = _.first @editor.selectWord()
      @adjustSelectionForDot(selection)
      @filterEditorView.setText(selection.getText())

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

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

      selection = _.first @editor.selectWord()
      return unless selection

      @insertMatch(match)

  selectNextItemView: ->
    super
