fun onQueryChanged()

in src/main/kotlin/org/jetbrains/plugins/template/components/SearchBarWithAutoCompletion.kt [185:209]


    fun onQueryChanged(searchTerm: String) {
        if (skipPopupShowing) {
            skipPopupShowing = false
            return
        }

        if (searchTerm.isEmpty()) {
            hidePopup()

            return
        }

        val newItems = itemsProvider.provideSearchableItems(searchTerm)
            .map { CompletionItem(it, false) }

        updateFilteredItems(newItems)

        moveSelectionToFirstItem()

        if (completionItems.isNotEmpty()) {
            showPopup()
        } else {
            hidePopup()
        }
    }