@param Autocomplete $autocomplete

@return string
332460
public function render(Autocomplete $autocomplete)
    {
        $formatter = $this->getFormatter();
        $jsonBuilder = $this->getJsonBuilder();

        if ($autocomplete->hasTypes()) {
            $jsonBuilder->setValue('[types]', $autocomplete->getTypes());
        }

        if ($autocomplete->hasBound()) {
            $jsonBuilder->setValue('[bounds]', $autocomplete->getBound()->getVariable(), false);
        }

        if ($autocomplete->hasComponents()) {
            $jsonBuilder->setValue('[componentRestrictions]', $autocomplete->getComponents());
        }

        if (!$jsonBuilder->hasValues()) {
            $jsonBuilder->setJsonEncodeOptions(JSON_FORCE_OBJECT);
        }

        return $formatter->renderObjectAssignment($autocomplete, $formatter->renderObject('Autocomplete', [
            $formatter->renderCall($formatter->renderProperty('document', 'getElementById'), [
                $formatter->renderEscape($autocomplete->getHtmlId()),
            ]),
            $jsonBuilder->build(),
        ], $formatter->renderClass('places')));
    }
1112409
public function getInput() {
        $options = $this->htmlOptions;
        $options['class'] = (isset($options['class']) ? $options['class'] . ' ' : '') . 'input autocomplete';
        $options['autc_ajax'] = ($this->ajaxUpdate?'1':'0');
        $options['autc_url'] = $this->ajaxURL;
        $options['autc_for'] = str_replace(['[', ']'], '__', $this->getName());
        $options['autc_minletters'] = $this->minLettersToSearch;
        $options['autc_insert'] = ($this->allowNewValues?'1':'0');
        $this->ajaxExtraParams[WebApp::get()->request()->getCsrfKey()] = WebApp::get()->request()->getCsrfValue();
        $options['autc_extraparams'] = json_encode($this->ajaxExtraParams);
        $opts = [];
        foreach ($this->options as $word){
            $opts[] = "<li>$word</li>";
        }
        $opts = implode("", $opts);
        return Form::get()->hiddenInput($this->getName(), $this->getValue(), ['id' => str_replace(['[', ']'], '__', $this->getName())])
            . Form::get()->input("", "text", $this->getValue(), $options)
            . Html::get()->tag("div", "<ul>$opts</ul>", ['id' => 'options-for-' . $options['autc_for'], 'class' => 'form-autocomplete-list'])
            . Html::get()->scriptFile($this->form->getAssetsURL()  . 'autocomplete.js');
    }
885078
public function setAutocomplete($autocomplete)
    {
        if ($autocomplete !== null && !is_callable($autocomplete)) {
            throw new \InvalidArgumentException('Invalid autocomplete function given');
        }

        $this->autocomplete = $autocomplete;

        return $this;
    }
1021187
private function doRender(Autocomplete $autocomplete, $eventName)
    {
        $this->getEventDispatcher()->dispatch($eventName, $event = new PlaceAutocompleteEvent($autocomplete));

        return $event->getCode();
    }
986209
public function collect(Autocomplete $autocomplete, array $domEvents = [])
    {
        return $this->collectValues($autocomplete->getEventManager()->getDomEvents(), $domEvents);
    }
657620
public function autocomplete($postcode)
    {
        $url = '/postcodes/' . rawurlencode($postcode) . '/autocomplete';
        $request = new Request('GET', $url);

        return $this->httpTransport($request);
    }
1238512
protected function _autoCompleteUrl($url) {
		if (mb_strpos($url, '/') === 0) {
			$url = Router::url($url, true);
		} elseif (mb_strpos($url, '://') === false && mb_strpos($url, 'www.') === 0) {
			$url = 'http://' . $url;
		}
		return $url;
	}
807851
public function autocomplete()
    {
        // Do nothing if the query is too short
        if (strlen(request('query')) < 1) {
            return Response::json();
        }

        // Get an instance so the title attributes can be found.  If none are found,
        // then there are no results, so bounce
        if (!$model = call_user_func([$this->model, 'first'])) {
            return Response::json($this->formatAutocompleteResponse([]));
        }

        // Get data matching the query
        $query = call_user_func([$this->model, 'titleContains'], request('query'))
            ->ordered()
            ->take(15); // Note, this is also enforced in the autocomplete.js

        // Don't return any rows already attached to the parent.  So make sure the
        // id is not already in the pivot table for the parent
        if ($this->isChildInManyToMany()) {

            // See if there is an exact match on what's been entered.  This is useful
            // for many to manys with tags because we want to know if the reason that
            // autocomplete returns no results on an exact match that is already
            // attached is because it already exists.  Otherwise, it would allow the
            // user to create the tag
            if ($this->parentRelation()
                ->titleContains(request('query'), true)
                ->count()) {
                return Response::json(['exists' => true]);
            }

            // Get the ids of already attached rows through the relationship function.
            // There are ways to do just in SQL but then we lose the ability for the
            // relationship function to apply conditions, like is done in polymoprhic
            // relationships.
            $siblings = $this->parentRelation()->get();
            if (count($siblings)) {
                $sibling_ids = [];
                foreach ($siblings as $sibling) {
                    $sibling_ids[] = $sibling->id;
                }

                // Add condition to query
                $model = new $this->model;
                $query = $query->whereNotIn($model->getQualifiedKeyName(), $sibling_ids);
            }
        }

        // Return result
        return Response::json($this->formatAutocompleteResponse($query->get()));
    }
1011545
protected function buildCompleteChildUrl($childUrlFragment)
    {
        if ($this->parentHandler !== null) {
            return $this->parentHandler->matchingUrl . $childUrlFragment;
        } else {
            return $childUrlFragment;
        }
    }
555193
def prompt_autocomplete(prompt, complete, default=None, contains_spaces=True, 
                        show_default=True, prompt_suffix=': ', color=None):
    

    def real_completer(text, state):
        possibilities = complete(text) + [None]

        if possibilities:
            return possibilities[state]
        return None

    readline.set_completer_delims('\t\n' + ' ' * (not contains_spaces))
    readline.parse_and_bind("tab: complete")
    readline.set_completer(real_completer)
    
    if default is not None and show_default:
        prompt += ' [%s]' % default

    prompt += prompt_suffix

    colors = {
        'red': Fore.RED,
        'blue': Fore.BLUE,
        'green': Fore.GREEN,
        'cyan': Fore.CYAN,
        'magenta': Fore.MAGENTA,
        'yellow': Fore.YELLOW,
        'white': Fore.WHITE,
        'black': Fore.LIGHTBLACK_EX
    }

    if color:
        prompt = colors[color.lower()] + prompt + Fore.RESET

    if default is not None:
        r = input(prompt)
    else:
        while True:
            r = input(prompt)
            if r:
                break

    r = r or default

    # remove the autocompletion before quitting for future input()
    readline.parse_and_bind('tab: self-insert')
    readline.set_completer(None)

    return r
182636
public void setAutocomplete(java.lang.String autocomplete) {
        getStateHelper().put(PropertyKeys.autocomplete, autocomplete);
    }
1157111
public function autocomplete($postalcode, $number = '', $extension = '')
    {
        $postalcode = $this->determinePostalType($postalcode);

        $this->data = array_merge($postalcode, ['streetnumber' => $number, 'extension' => $extension]);

        return $this->call('autocomplete', $this->prepareData($this->data));
    }
354866
public function setAutocomplete(string $state = 'on'): Form
    {
        $states = [
            'on',
            'off'
        ];

        if (!in_array(strtolower($state), $states))
            Throw new FormException('Wrong html form autocomplete attribute state.', 1000);

        $this->attribute['autocomplete'] = $state;

        return $this;
    }
1189375
def users_autocomplete(self, name=None, **kwargs):
        ""
        api_path = "/api/v2/users/autocomplete.json"
        api_query = {}
        if "query" in kwargs.keys():
            api_query.update(kwargs["query"])
            del kwargs["query"]
        if name:
            api_query.update({
                "name": name,
            })
        return self.call(api_path, query=api_query, **kwargs)
271095
public function setAutocomplete($bit = true)
    {
        $this->autocomplete = (Boolean) $bit;
        $this->setSearchProperty($bit);
        return $this;
    }
163937
public function askInput($questionText, $default = null, array $autoCompleterValues = [], callable $validator = null)
    {
        if ($default !== null) {
            $questionText .= ' <question>[' . $default . ']</question>';
        }
        $questionText .= ': ';
        $question = new Question($questionText, $default);
        if (!empty($autoCompleterValues)) {
            $question->setAutocompleterValues($autoCompleterValues);
        }
        if ($validator !== null) {
            $question->setValidator($validator);
            $question->setMaxAttempts(5);
        }

        return $this->ask($this->input, $this->output, $question);
    }
1007320
public function autocomplete($config = array())
    {
        $config = new ObjectConfigJson($config);
        $config->append(array(
            'element'  => null,
            'options_callback' => null, // wraps the call to select2 options in JavaScript, can be used to add JS code
            'options'  => array(
                'minimumInputLength' => 2,
                'validate'      => false, //Toggle if the forms validation helper is loaded
                'queryVarName'  => 'search',
                'width'         => 'resolve',
                'name'          => '',
                'model'		    => $config->model,
                'placeholder'   => $config->prompt,
                'allowClear'    => $config->deselect,
                'value'         => $config->value,
                'text'          => $config->text,
                'selected'      => $config->selected,
                'url'           => $config->ajax_url,
                'multiple'      => false
            )
        ))->append(array(
            'options' => array(
                'label' => $config->text
            )
        ));

        $html ='';

        if (!$config->options->url instanceof HttpUrl) {
            $config->options->url = $this->getObject('lib:http.url', ['url' => $config->options->url]);
        }

        if(!empty($config->name))
        {
            $config->options->url->setQuery(array('fields['.$config->name.']' => $config->value.','.$config->text), true);
            $config->options->url = (string)$config->options->url;
        }

        $options   = $config->options;
        $signature = md5('autocomplete-'.$config->element.$config->options_callback.$options);

        if($config->element && !static::isLoaded($signature))
        {
            $options = (string) $options;

            if ($config->options_callback) {
                $options = $config->options_callback.'('.$options.')';
            }

            $html .= $this->select2(array('element' => false));

            if (!static::isLoaded('kodekit-select2-autocomplete')) {
                $html .= '<script>
                if(!Kodekit) {
                    var Kodekit = typeof Koowa !== "undefined" ?  Koowa : {};
                }
                
                Kodekit.getSelect2Options = function(options) {
                    var defaults = {
                        width: "resolve",
                        minimumInputLength: 2,
                        theme: "bootstrap",
                        ajax: {
                            url: options.url,
                            delay: 100,
                            data: function (params) {
                                var page  = params.page || 1,  // page is the one-based page number tracked by Select2
                                    query = {
                                        limit: 10, // page size
                                        offset: (page-1)*10
                                    };
                                query[options.queryVarName] = params.term;
            
                                return query;
                            },
                            processResults: function (data, page) {
                                var results = [],
                                    more = (page * 10) < data.meta.total; // whether or not there are more results available
            
                                kQuery.each(data.data, function(i, item) {
                                    // Change format to what select2 expects
                                    item.id   = item.attributes[options.value];
                                    item.text = item.attributes[options.text];
            
                                    results.push(item);
                                });
            
                                // notice we return the value of more so Select2 knows if more results can be loaded
                                return {results: results, more: more};
                            }
                        }
                    };
                    
                    var settings = kQuery.extend( {}, defaults, options);
                    
                    return settings;
                };
                </script>';

                static::setLoaded('kodekit-select2-autocomplete');
            }

            $html .= '<script>
            kQuery(function($){
                $("'.$config->element.'").select2(Kodekit.getSelect2Options('.$options.'));
            });</script>';

            static::setLoaded($signature);
        }

        return $html;
    }