Process an autocomplete request from the client

@method autocomplete
@param {Object} params Named parameters
@param {Function(error, returnParams)} callback Callback function
334241
function(params, callback) {
      var t = this;
      if (typeof(params) !== 'string' || params.length < 1) {
        callback("Autocomplete paramter must be a nonzero string");
      }

      // Forward to the completion mechanism if it can be completed
      if (params.substr(-1).match(/([0-9])|([a-z])|([A-Z])|([_])/)) {
        t.repl.complete(params, callback);
      } else {
        // Return a no-op autocomplete
        callback(null, [[],'']);
      }
    }
617495
function(searchTerm) {
    var suggestions = [ ];
    var popup = this.getElement({type: "searchBar_autoCompletePopup"});
    var treeElem = this.getElement({type: "searchBar_suggestions"});

    // Enter search term and wait for the popup
    this.type(searchTerm);

    this._controller.waitForEval("subject.popup.state == 'open'", TIMEOUT, 100,
                                 {popup: popup.getNode()});
    this._controller.waitForElement(treeElem, TIMEOUT);

    // Get all suggestions
    var tree = treeElem.getNode();
    this._controller.waitForEval("subject.tree.view != null", TIMEOUT, 100,
                                 {tree: tree});
    for (var i = 0; i < tree.view.rowCount; i ++) {
      suggestions.push(tree.view.getCellText(i, tree.columns.getColumnAt(0)));
    }

    // Close auto-complete popup
    this._controller.keypress(popup, "VK_ESCAPE", {});
    this._controller.waitForEval("subject.popup.state == 'closed'", TIMEOUT, 100,
                                 {popup: popup.getNode()});

    return suggestions;
  }
1136077
function invokeOnComplete(slinkerOptions) {
    if (typeof slinkerOptions.onComplete === 'function' && slinkerOptions.modules.length === symlinksCreated.length) {
        slinkerOptions.onComplete();
    }
}
1022763
private void onAutoCompleted(final Event event, final Suggestion<T> suggestion) {
        TypeaheadAutoCompletedEvent.fire(this, suggestion, event);
    }
117686
function linkAutoComplete() {
    return listFiles('autocomplete')
        .then(filter(endsWith('.js')) & map(path.join('autocomplete', _)))
        .tap(files => all(files.map(file => fs.readFileAsync(file)
            .then(ensureNoImports(file)))));
}
462969
function autoCompleteResults(controller) {
  this._controller = controller;
  this._popup = this.getElement({type: "popup"});
  this._results = this.getElement({type: "results"});
}
31366
function ( callback ) {
					self.api.call( _.extend( params, continueParams ), function ( err, data, next ) {
						if ( err ) {
							callback( err );
						} else {
							// append batch data
							const batchData = ( typeof key === 'function' ) ? key( data ) : data[ key ];

							res = res.concat( batchData );

							// more pages?
							continueParams = next;
							callback( next ? null : true );
						}
					} );
				}
1042653
protected function _applyAutocompleteOptions(&$input, $param)
    {
        if ($param instanceof AutocompleteParameter) {
            $input['data-url'] = $param->autocompleteUrl();
            $input['class'] = 'autocomplete';
            $input['data-name'] = $param->config('name');
        }

        return $input;
    }
656542
function complete(todo) {
            vm.error = undefined;
            service.complete(todo, function() {
                _fetch();
            }, function() {
                vm.error = 'An error occurred when completing a todo';
            });
        }
885297
public function autocomplete()
    {
        $this->loadComponent('RequestHandler');
        $this->viewClass = 'Json';
        $data = [];
        $paramName = $this->request->query('parameter');
        $query = $this->request->query('query');
        $parameter = $this->Filter->parameters()->get($paramName);
        if (!empty($parameter)) {
            $method = $parameter->config('autocompleteAction');
            $data = $method($query);
            $this->set('status', 'success');
        } else {
            $this->set('status', 'error');
            $this->set('message', __('Field not found'));
        }
        $this->set('data', $data);
        $this->set('_serialize', ['data', 'status', 'message']);
    }
199496
function paramCallback(err) {
                var fn = paramCallbacks[paramIndex++];
                if (err || !fn) return param(err);
                fn(req, res, paramCallback, paramVal, key.name);
            }
941098
function onComplete (err) {
    if (err) {
      console.log('interpolation encountered an error: ', err)
      return callback(err)
    }
    // set is complete and create a queue drain function
    // however, a feed may not have any interpolated times, so
    // `isComplete` is set in case nothing is pushed to the queue
    isComplete = true
    updateQueue.drain = () => {
      console.log('interpolation completed successfully')
      callback(err)
    }
  }
996603
public function param( $param_name, $callback )
	{
		if( is_callable($callback) )
		{
			$this->_params[$param_name] = $callback( new request() );
		}
		else
		{
			$this->_params[$param_name] = $callback;
		}
	}
350164
private CallbackResult<V> processListeners(Set<BlockPos> list, Chunk chunk, Object... params)
	{
		CallbackResult<V> result = CallbackResult.noResult();
		for (BlockPos listener : list)
		{
			CallbackResult<V> tmp = super.processCallbacks(chunk, listener, params);
			result = reduce.apply(result, tmp);
			if (result.isForcedCancelled())
				return result;
		}
		return result;
	}
496020
function init(autocomplete) {
    if (autocomplete.__bunny_autocomplete !== undefined) {
      return false;
    }
    autocomplete.__bunny_autocomplete = {};
    autocomplete.__bunny_autocomplete_state = this.getCurState(autocomplete);
    this._addEvents(autocomplete);
    this._setARIA(autocomplete);

    initObjectExtensions(this, autocomplete);

    return true;
  }
1264329
function cmd(method, params, callback, streamResults, returnRawData){

        var results = [];

        async.each(instances, function(instance, eachCallback){

            var itemFinished = function(error, result, data){

                var returnObj = {
                    error: error,
                    response: (result || {}).result,
                    instance: instance
                };
                if (returnRawData) returnObj.data = data;
                if (streamResults) callback(returnObj);
                else results.push(returnObj);
                eachCallback();
                itemFinished = function(){};
            };

            var requestJson = JSON.stringify({
                method: method,
                params: params,
                id: Date.now() + Math.floor(Math.random() * 10)
            });

            performHttpRequest(instance, requestJson, function(error, result, data){
                itemFinished(error, result, data);
            });


        }, function(){
            if (!streamResults){
                callback(results);
            }
        });

    }
242808
function ( params, callback, method, done ) {
			const self = this,
				// store requested action - will be used when parsing a response
				actionName = params.action,
				// "request" options
				options = {
					method: method || 'GET',
					proxy: this.proxy || false,
					jar: this.jar,
					headers: {
						'User-Agent': this.userAgent
					}
				};

			// HTTP request parameters
			params = params || {};

			// force JSON format
			params.format = 'json';

			// handle uploads
			if ( method === 'UPLOAD' ) {
				options.method = 'POST';

				const CRLF = '\r\n',
					postBody = [],
					boundary = `nodemw${Math.random().toString().substr( 2 )}`;

				// encode each field
				Object.keys( params ).forEach( function ( fieldName ) {
					const value = params[ fieldName ];

					postBody.push( `--${boundary}` );
					postBody.push( CRLF );

					if ( typeof value === 'string' ) {
					// properly encode UTF8 in binary-safe POST data
						postBody.push( `Content-Disposition: form-data; name="${fieldName}"` );
						postBody.push( CRLF );
						postBody.push( CRLF );
						postBody.push( new Buffer( value, 'utf8' ) );
					} else {
					// send attachment
						postBody.push( `Content-Disposition: form-data; name="${fieldName}"; filename="foo"` );
						postBody.push( CRLF );
						postBody.push( CRLF );
						postBody.push( value );
					}

					postBody.push( CRLF );
				} );

				postBody.push( `--${boundary}--` );

				// encode post data
				options.headers[ 'content-type' ] = `multipart/form-data; boundary=${boundary}`;
				options.body = postBody;

				params = {};
			}

			// form an URL to API
			options.url = this.formatUrl( {
				protocol: this.protocol,
				port: this.port,
				hostname: this.server,
				pathname: this.path + '/api.php',
				query: ( options.method === 'GET' ) ? params : {}
			} );

			// POST all parameters (avoid "request string too long" errors)
			if ( method === 'POST' ) {
				options.form = params;
			}

			this.logger.debug( 'API action: %s', actionName );
			this.logger.debug( '%s <%s>', options.method, options.url );
			if ( options.form ) {
				this.logger.debug( 'POST fields: %s', Object.keys( options.form ).join( ', ' ) );
			}

			request( options, function ( error, response, body ) {
				response = response || {};

				if ( error ) {
					self.logger.error( 'Request to API failed: %s', error );
					callback( new Error( `Request to API failed: ${error}` ) );
					done();
					return;
				}

				if ( response.statusCode !== 200 ) {
					self.logger.error( 'Request to API failed: HTTP status code was %d for <%s>', response.statusCode || 'unknown', options.url );
					self.logger.debug( 'Body: %s', body );

					self.logger.data( new Error().stack );

					callback( new Error( `Request to API failed: HTTP status code was ${response.statusCode}` ) );
					done();
					return;
				}

				// parse response
				let data,
					info,
					next;

				try {
					data = JSON.parse( body );
					info = data && data[ actionName ];

					// acfrom=Zeppelin Games
					next = data && data[ 'query-continue' ] && data[ 'query-continue' ][ params.list || params.prop ];

					// handle the new continuing queries introduced in MW 1.21
					// (and to be made default in MW 1.26)
					// issue #64
					// @see https://www.mediawiki.org/wiki/API:Query#Continuing_queries
					if ( !next ) {
					// cmcontinue=page|5820414e44205920424f534f4e53|12253446, continue=-||
						next = data && data.continue;
					}
				} catch ( e ) {
					self.logger.error( 'Error parsing JSON response: %s', body );
					self.logger.data( body );

					callback( new Error( 'Error parsing JSON response' ) );
					done();
					return;
				}

				// if (!callback) data.error = {info: 'foo'}; // debug

				if ( data && !data.error ) {
					if ( next ) {
						self.logger.debug( 'There\'s more data' );
						self.logger.debug( next );
					}

					callback( null, info, next, data );
				} else if ( data.error ) {
					self.logger.error( 'Error returned by API: %s', data.error.info );
					self.logger.data( data.error );

					callback( new Error( `Error returned by API: ${data.error.info}` ) );
				}
				done();
			} );
		}