LAB-84: Use text that appears in search to construct the language model

GitOrigin-RevId: 65fffcd85b9833e277fd998f0b114ee48b36babb
This commit is contained in:
Adam Malek
2024-04-27 23:06:49 +00:00
committed by intellij-monorepo-bot
parent e17be19c6e
commit 8fc4c0d4e0
@@ -4,6 +4,7 @@ import com.intellij.ide.ui.search.SearchableOptionsRegistrar
import com.intellij.ide.ui.search.SearchableOptionsRegistrarImpl
import com.intellij.openapi.actionSystem.ActionGroup
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.ActionPlaces
import com.intellij.openapi.actionSystem.impl.ActionManagerImpl
import com.intellij.openapi.components.Service
import com.intellij.openapi.components.service
@@ -60,7 +61,11 @@ internal class ActionsLanguageModel(val coroutineScope: CoroutineScope) {
private fun getWordsFromActions(): Sequence<@NlsActions.ActionText String> {
return (ActionManager.getInstance() as ActionManagerImpl).actionsOrStubs()
.filterNot { it is ActionGroup && !it.isSearchable }
.mapNotNull { it.templateText }
.mapNotNull {
val presentation = it.templatePresentation
it.applyTextOverride(ActionPlaces.ACTION_SEARCH, presentation)
return@mapNotNull presentation.text
}
}
private fun getWordsFromSettings(): Sequence<@NlsContexts.ConfigurableName CharSequence> {