mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
IJPL-188383 Search Everywhere, All tab: 'Top Hit' filter is duplicated
(cherry picked from commit 1954d2ad0712b4cee9de50aedbf00ef782c5c18f) IJ-CR-169646 GitOrigin-RevId: be62d6d4c1265b1dd4043c95e0a3b01acbc16b8b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
200d15fa4f
commit
830a094ed8
@@ -45,6 +45,7 @@ class SeTabDelegate(
|
||||
|
||||
fun getItems(params: SeParams, disabledProviders: List<SeProviderId>? = null): Flow<SeResultEvent> {
|
||||
val accumulator = SeResultsAccumulator(providersAndLimits)
|
||||
val disabledProviders = fixDisabledProviders(disabledProviders)
|
||||
|
||||
return flow {
|
||||
disabledProviders?.forEach {
|
||||
@@ -202,6 +203,20 @@ class SeTabDelegate(
|
||||
}
|
||||
}
|
||||
|
||||
// Workaround for: IJPL-188383 Search Everywhere, All tab: 'Top Hit' filter is duplicated
|
||||
// Add/remove Top Hit (On Client) according to the presence of Top Hit provider
|
||||
private fun fixDisabledProviders(disabledProviders: List<SeProviderId>?): List<SeProviderId>? {
|
||||
val all = disabledProviders?.toMutableSet() ?: return null
|
||||
|
||||
val topHitClientId = SeProviderIdUtils.TOP_HIT_ID.toProviderId()
|
||||
if (all.contains(SeProviderIdUtils.TOP_HIT_HOST_ID.toProviderId())) {
|
||||
all.add(topHitClientId)
|
||||
}
|
||||
else all.remove(topHitClientId)
|
||||
|
||||
return all.toList()
|
||||
}
|
||||
|
||||
companion object {
|
||||
suspend fun shouldShowLegacyContributorInSeparateTab(
|
||||
project: Project,
|
||||
|
||||
@@ -103,7 +103,13 @@ private class SeAllFilterEditor(providersIdToName: Map<SeProviderId, @Nls String
|
||||
}
|
||||
|
||||
private fun getFilterTypesAction(providersIdToName: Map<SeProviderId, @Nls String>): AnAction {
|
||||
val namesMap = providersIdToName.map { it.key.value to it.value }.toMap()
|
||||
val namesMap = providersIdToName.mapNotNull {
|
||||
// Workaround for: IJPL-188383 Search Everywhere, All tab: 'Top Hit' filter is duplicated
|
||||
// Don't add 'Top Hit (On Client)' to the list of providers
|
||||
if (it.key.value == SeProviderIdUtils.TOP_HIT_ID) return@mapNotNull null
|
||||
|
||||
it.key.value to it.value
|
||||
}.toMap()
|
||||
|
||||
val configuration = SearchEverywhereConfiguration.getInstance()
|
||||
val persistentFilter =
|
||||
|
||||
Reference in New Issue
Block a user