Minor: remove deprecated usages of PsiSearchHelper.SERVICE
This commit is contained in:
@@ -28,6 +28,7 @@ import com.intellij.psi.search.PsiSearchHelper
|
||||
import com.intellij.psi.search.SearchScope
|
||||
import com.intellij.psi.search.searches.ReferencesSearch
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||
import org.jetbrains.kotlin.idea.util.compat.psiSearchHelperInstance
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.types.expressions.OperatorConventions
|
||||
@@ -93,8 +94,7 @@ fun SearchScope.excludeFileTypes(vararg fileTypes: FileType): SearchScope {
|
||||
fun ReferencesSearch.SearchParameters.effectiveSearchScope(element: PsiElement): SearchScope {
|
||||
if (element == elementToSearch) return effectiveSearchScope
|
||||
if (isIgnoreAccessScope) return scopeDeterminedByUser
|
||||
// BUNCH: 181
|
||||
@Suppress("DEPRECATION") val accessScope = PsiSearchHelper.SERVICE.getInstance(element.project).getUseScope(element)
|
||||
val accessScope = psiSearchHelperInstance(element.project).getUseScope(element)
|
||||
return scopeDeterminedByUser.intersectWith(accessScope)
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -52,6 +52,7 @@ import org.jetbrains.kotlin.idea.search.restrictToKotlinSources
|
||||
import org.jetbrains.kotlin.idea.util.FuzzyType
|
||||
import org.jetbrains.kotlin.idea.util.ProjectRootsUtil
|
||||
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
||||
import org.jetbrains.kotlin.idea.util.compat.psiSearchHelperInstance
|
||||
import org.jetbrains.kotlin.kdoc.psi.impl.KDocName
|
||||
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor
|
||||
import org.jetbrains.kotlin.load.java.sam.SingleAbstractMethodUtils
|
||||
@@ -368,9 +369,7 @@ class ExpressionsOfTypeProcessor(
|
||||
}
|
||||
}
|
||||
|
||||
// BUNCH: 181
|
||||
@Suppress("DEPRECATION")
|
||||
PsiSearchHelper.SERVICE.getInstance(project).processRequests(searchRequestCollector) { reference ->
|
||||
psiSearchHelperInstance(project).processRequests(searchRequestCollector) { reference ->
|
||||
if (reference.element.parents.any { it is KtImportDirective }) {
|
||||
// Found declaration in import - process all file with an ordinal reference search
|
||||
val containingFile = reference.element.containingFile
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.util.compat
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.search.PsiSearchHelper
|
||||
|
||||
// BUNCH: 181
|
||||
@Suppress("IncompatibleAPI")
|
||||
fun psiSearchHelperInstance(project: Project): PsiSearchHelper {
|
||||
return PsiSearchHelper.getInstance(project)
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.util.compat
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.search.PsiSearchHelper
|
||||
|
||||
// BUNCH: 181
|
||||
@Suppress("IncompatibleAPI")
|
||||
fun psiSearchHelperInstance(project: Project): PsiSearchHelper {
|
||||
return PsiSearchHelper.SERVICE.getInstance(project)
|
||||
}
|
||||
Reference in New Issue
Block a user