<commit_before>{% block ecommit_javascript_select2entityajax_widget %}
    {% spaceless %}
        {{ form_widget(form) }}
        <script type="text/javascript">
            $(function() {
                $("#{{ id }}").select2({
                    minimumInputLength: {{ min_chars }},
                    placeholder: '{{ place_holder }}',
                    allowClear: true,
                    ajax: {
                        url: "{{ url }}",
                        dataType: 'json',
                        data: function (term, page) {
                            return {
                                term: term,
                                page: page
                            }
                        },
                        results: function (data, page) {
                            var more = page < data.totalPages;

                            return {results: data.results, more: more };
                        }
                    },
                    formatResult: function (data) {
                        return data.label;
                    },
                    formatSelection: function (data) {
                        return data.label;
                    },
                    id: function(bond){ return bond.key; },
                    initSelection : function (element, callback) {
                        var text = $(element).attr('data-selected-data');
                        var data = {key: element.val(), label: text};
                        callback(data);
                    },
                    width: "350px"
                });
            });
        </script>
    {% endspaceless %}
{% endblock %}

{% block ecommit_javascript_select2entity_widget %}
    {% spaceless %}
        {{ form_widget(form) }}
        {{ block('ecommit_javascript_select2_js') }}
    {% endspaceless %}
{% endblock %}

{% block ecommit_javascript_select2_js %}
    <script type="text/javascript">
        $(function() {
            $("#{{ id }}").select2({
                placeholder: '{{ place_holder }}',
                allowClear: true,
                width: "350px"
            });
        });
    </script>
{% endblock %}<commit_msg>Select2EntityAjaxType : Add markMatch call in formatResult function<commit_after>{% block ecommit_javascript_select2entityajax_widget %}
    {% spaceless %}
        {{ form_widget(form) }}
        <script type="text/javascript">
            $(function() {
                $("#{{ id }}").select2({
                    minimumInputLength: {{ min_chars }},
                    placeholder: '{{ place_holder }}',
                    allowClear: true,
                    ajax: {
                        url: "{{ url }}",
                        dataType: 'json',
                        data: function (term, page) {
                            return {
                                term: term,
                                page: page
                            }
                        },
                        results: function (data, page) {
                            var more = page < data.totalPages;

                            return {results: data.results, more: more };
                        }
                    },
                    formatResult: function(result, container, query, escapeMarkup) {
                        var markup=[];
                        window.Select2.util.markMatch(result.label, query.term, markup, escapeMarkup);
                        return markup.join("");
                    },
                    formatSelection: function (data) {
                        return data.label;
                    },
                    id: function(bond){ return bond.key; },
                    initSelection : function (element, callback) {
                        var text = $(element).attr('data-selected-data');
                        var data = {key: element.val(), label: text};
                        callback(data);
                    },
                    width: "350px"
                });
            });
        </script>
    {% endspaceless %}
{% endblock %}

{% block ecommit_javascript_select2entity_widget %}
    {% spaceless %}
        {{ form_widget(form) }}
        {{ block('ecommit_javascript_select2_js') }}
    {% endspaceless %}
{% endblock %}

{% block ecommit_javascript_select2_js %}
    <script type="text/javascript">
        $(function() {
            $("#{{ id }}").select2({
                placeholder: '{{ place_holder }}',
                allowClear: true,
                width: "350px"
            });
        });
    </script>
{% endblock %}
{'fraction_non_alphanumeric': 0.11855223233636758, 'fraction_numerical': 0.005635023840485479, 'mean_word_length': 1.0611880303707013, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '914206', 'n_tokens_mistral': 1134, 'n_tokens_neox': 1015, 'n_words': 210}