0

I am trying to write autocomplete control using jquery ui for dialog model(using Mustache to render the model dialog) for brackets plugin.

like this.

function bindSelect() {
        var tags = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"];
        $("#mySelectDropDown").autocomplete({
            source: function (request, response) {
                var matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex(request.term), "i");
                response($.grep(tags, function (item) {
                    return matcher.test(item);
                }));
            }
        });
}

but i am getting the error $.ui is undefined. Seems adobe brackets dialog unable to find $.ui api. Because the same code is working fine in other place apart from dialog window.

Thanks in advance

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
Ashish Yadav
  • 99
  • 3
  • 5

1 Answers1

0

Brackets doesn't use jQuery UI, so it's not included in the runtime environment. You could add it to your extension and load it when your extension loads, but then it'll be plugged into jQuery globally throughout Brackets -- so please test to make sure jQuery UI doesn't interfere with any other parts of Brackets.

Or as an alternative, you could wait until the QuickSearchField widget lands in Brackets core, then just use that instead. The API is a little different (and perhaps a bit less compact), but the overall principle works exactly the same as what your code is doing above -- you have a provider that is given the string the user typed, and returns a list of items to show in the dropdown.

peterflynn
  • 4,667
  • 2
  • 27
  • 40