mirror of
https://github.com/JetBrains/intellij-platform-plugin-template.git
synced 2025-12-05 06:11:52 +00:00
Refactor: Rename isSearchApplicable to matches for clarity and consistency
This commit is contained in:
parent
8fe4926fb7
commit
ef4e5c8c6c
@ -13,7 +13,7 @@ import androidx.compose.runtime.Immutable
|
|||||||
data class Location(val name: String, val country: String) : PreviewableItem, Searchable {
|
data class Location(val name: String, val country: String) : PreviewableItem, Searchable {
|
||||||
val id: String = "$name, $country"
|
val id: String = "$name, $country"
|
||||||
|
|
||||||
override fun isSearchApplicable(query: String): Boolean {
|
override fun matches(query: String): Boolean {
|
||||||
val applicableCandidates = listOf(
|
val applicableCandidates = listOf(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
|
|||||||
@ -4,5 +4,5 @@ package org.jetbrains.plugins.template.weatherApp.model
|
|||||||
* Represents an entity that can be filtered by a search query.
|
* Represents an entity that can be filtered by a search query.
|
||||||
*/
|
*/
|
||||||
interface Searchable {
|
interface Searchable {
|
||||||
fun isSearchApplicable(query: String): Boolean
|
fun matches(query: String): Boolean
|
||||||
}
|
}
|
||||||
@ -27,6 +27,6 @@ class LocationsProvider : SearchAutoCompletionItemProvider<Location> {
|
|||||||
override fun provideSearchableItems(searchTerm: String): List<Location> {
|
override fun provideSearchableItems(searchTerm: String): List<Location> {
|
||||||
return locationStateFlow
|
return locationStateFlow
|
||||||
.value
|
.value
|
||||||
.filter { it.isSearchApplicable(searchTerm) }
|
.filter { it.matches(searchTerm) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user