Search Everywhere | File search gotoFileContributor not work from 2022.01


I implemented ChooseByNameContributorEx2 for next behavior:

When I click ctrl+n (File search) and enter MY-FILE-NAME, I want to found MY_FILE_NAME.groovy too.

<gotoFileContributor implementation="com.icthh.xm.extensions.LepChooseByNameContributor" />

open class LepChooseByNameContributor2: ChooseByNameContributorEx2 {

val delegate: ChooseByNameContributorEx = DefaultFileNavigationContributor()

override fun processNames(processor: Processor<in String>, parameters: FindSymbolParameters) {
processNames(processor, parameters.searchScope, parameters.idFilter)

override fun processNames(processor: Processor<in String>, scope: GlobalSearchScope, filter: IdFilter?) {
delegate.processNames({ name ->
if (name.endsWith(".groovy")) {
}, scope, filter)

override fun processElementsWithName(
name: String,
processor: Processor<in NavigationItem>,
parameters: FindSymbolParameters
) {
val completePattern = parameters.completePattern
val transliteratedPattern = replaceToUnderscores(completePattern)
if (transliteratedPattern != completePattern) {
val transliteratedName = replaceToUnderscores(name.substringBeforeLast(".groovy")) + ".groovy"
transliteratedName, processor,
FindSymbolParameters(transliteratedPattern, transliteratedName, parameters.searchScope)

private fun replaceFromUnderscores(symbol: String) = symbol.replace("_".toRegex(), "-")

private fun replaceToUnderscores(symbol: String) = symbol.replace("-".toRegex(), "_")


It works fine in previous version of intellij idea. But on 2022.01 it does not work.

1 comment
Comment actions Permalink

This should be fixed in upcoming 2022.1.1 bugfix release.


Please sign in to leave a comment.