lib/autocomplete-manager.js
// match - The match to replace the current prefix with
The match to replace the current prefix with
The match to replace the current prefix with
replaceTextWithMatch (suggestion) {
    if (this.editor == null) { return }
    const cursors = this.editor.getCursors()
    if (cursors == null) { return }
    return this.editor.transact(() => {
      for (let i = 0; i < cursors.length; i++) {
        const cursor = cursors[i]
        const endPosition = cursor.getBufferPosition()
        const beginningPosition = [endPosition.row, endPosition.column - suggestion.replacementPrefix.length]
        if (this.editor.getTextInBufferRange([beginningPosition, endPosition]) === suggestion.replacementPrefix) {
          const suffix = this.consumeSuffix ? this.getSuffix(this.editor, endPosition, suggestion) : ''
          if (suffix.length) { cursor.moveRight(suffix.length) }
          cursor.selection.selectLeft(suggestion.replacementPrefix.length + suffix.length)
          if ((suggestion.snippet != null) && (this.snippetsManager != null)) {
            this.snippetsManager.insertSnippet(suggestion.snippet, this.editor, cursor)
          } else {
            cursor.selection.insertText(suggestion.text != null ? suggestion.text : suggestion.snippet, {
              autoIndentNewline: this.editor.shouldAutoIndent(),
              autoDecreaseIndent: this.editor.shouldAutoIndent()
            })
          }
        }
      }
    }
    )
  }
replaceTextWithMatch ( suggestion ) { if ( this . editor == null ) { return } const cursors = this . editor . getCursors ( ) if ( cursors == null ) { return } return this . editor . transact ( ( ) => { for ( let i = 0 ; i < cursors . length ; i ++ ) { const cursor = cursors [ i ] const endPosition = cursor . getBufferPosition ( ) const beginningPosition = [ endPosition . row , endPosition . column - suggestion . replacementPrefix . length ] if ( this . editor . getTextInBufferRange ( [ beginningPosition , endPosition ] ) === suggestion . replacementPrefix ) { const suffix = this . consumeSuffix ? this . getSuffix ( this . editor , endPosition , suggestion ) : '' if ( suffix . length ) { cursor . moveRight ( suffix . length ) } cursor . selection . selectLeft ( suggestion . replacementPrefix . length + suffix . length ) if ( ( suggestion . snippet != null ) && ( this . snippetsManager != null ) ) { this . snippetsManager . insertSnippet ( suggestion . snippet , this . editor , cursor ) } else { cursor . selection . insertText ( suggestion . text != null ? suggestion . text : suggestion . snippet , { autoIndentNewline : this . editor . shouldAutoIndent ( ) , autoDecreaseIndent : this . editor . shouldAutoIndent ( ) } ) } } } } ) }
match - The match to replace the current prefix with
match - The match to replace the current prefix with