override fun collectSearchRequests()

in src/main/kotlin/com/pestphp/pest/features/customExpectations/symbols/PestCustomExpectationRenameUsageSearcher.kt [21:39]


    override fun collectSearchRequests(parameters: RenameUsageSearchParameters): Collection<Query<out RenameUsage>> {
        val targetSymbol = parameters.target as? PestCustomExpectationSymbol ?: return emptyList()
        val symbolPointer: Pointer<PestCustomExpectationSymbol> = targetSymbol.createPointer()
        val usages = SearchService.getInstance()
            .searchWord(parameters.project, targetSymbol.expectationName)
            .caseSensitive(true)
            .inContexts(SearchContext.inCode())
            .inFilesWithLanguage(PhpLanguage.INSTANCE)
            .inScope(parameters.searchScope)
            .buildQuery(LeafOccurrenceMapper.withPointer(symbolPointer, ::findReferencesToSymbol))
        val selfUsage = PestCustomExtensionDeclarationUsageQuery(
            PsiModifiableRenameUsage.defaultPsiModifiableRenameUsage(targetSymbol.declarationUsage())
        )
        return listOf(usages.mapping {
            PsiModifiableRenameUsage.defaultPsiModifiableRenameUsage(
                PsiUsage.textUsage(it.element.containingFile, it.element.nameNode!!.textRange)
            )
        }, selfUsage)
    }