mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
[kotlin] find usages: filter out usages in labeled returns
^KTIJ-13315 fixed GitOrigin-RevId: e9b6e183da977588b0bbff33820c5eb80f732c5a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e744a14e78
commit
0ef24c53af
@@ -1,4 +1,2 @@
|
||||
Function call 12 foo(fun(): Boolean { return@foo false })
|
||||
Function call 8 foo {
|
||||
Unclassified 12 foo(fun(): Boolean { return@foo false })
|
||||
Unclassified 9 return@foo false
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
[labeledReturns.0.kt] Function call 13 foo(fun(): Boolean { return@foo false })
|
||||
[labeledReturns.0.kt] Function call 9 foo {
|
||||
[labeledReturns.0.kt] Unclassified 10 return@foo false
|
||||
[labeledReturns.0.kt] Unclassified 13 foo(fun(): Boolean { return@foo false })
|
||||
[labeledReturns.0.kt] Usage in import 6 import library.foo
|
||||
[labeledReturns.kt] Function call 10 foo(fun(): Boolean { return@foo false })
|
||||
[labeledReturns.kt] Function call 6 foo {
|
||||
[labeledReturns.kt] Unclassified 10 foo(fun(): Boolean { return@foo false })
|
||||
[labeledReturns.kt] Unclassified 7 return@foo false
|
||||
|
||||
@@ -106,10 +106,16 @@ abstract class KotlinFindMemberUsagesHandler<T : KtNamedDeclaration> protected c
|
||||
)
|
||||
}
|
||||
|
||||
override fun applyQueryFilters(element: PsiElement, options: FindUsagesOptions, query: Query<PsiReference>): Query<PsiReference> {
|
||||
override fun applyQueryFilters(
|
||||
element: PsiElement,
|
||||
options: FindUsagesOptions,
|
||||
fromHighlighting: Boolean,
|
||||
query: Query<PsiReference>
|
||||
): Query<PsiReference> {
|
||||
val kotlinOptions = options as KotlinFunctionFindUsagesOptions
|
||||
return query
|
||||
.applyFilter(kotlinOptions.isSkipImportStatements) { !it.isImportUsage() }
|
||||
.applyFilter(!fromHighlighting) { it.element !is KtLabelReferenceExpression }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +199,12 @@ abstract class KotlinFindMemberUsagesHandler<T : KtNamedDeclaration> protected c
|
||||
)
|
||||
}
|
||||
|
||||
override fun applyQueryFilters(element: PsiElement, options: FindUsagesOptions, query: Query<PsiReference>): Query<PsiReference> {
|
||||
override fun applyQueryFilters(
|
||||
element: PsiElement,
|
||||
options: FindUsagesOptions,
|
||||
fromHighlighting: Boolean,
|
||||
query: Query<PsiReference>
|
||||
): Query<PsiReference> {
|
||||
val kotlinOptions = options as KotlinPropertyFindUsagesOptions
|
||||
|
||||
if (!kotlinOptions.isReadAccess && !kotlinOptions.isWriteAccess) {
|
||||
@@ -278,7 +289,7 @@ abstract class KotlinFindMemberUsagesHandler<T : KtNamedDeclaration> protected c
|
||||
|
||||
val searchParameters = KotlinReferencesSearchParameters(element, options.searchScope, kotlinOptions = kotlinSearchOptions)
|
||||
|
||||
addTask { applyQueryFilters(element, options, ReferencesSearch.search(searchParameters)).forEach(referenceProcessor) }
|
||||
addTask { applyQueryFilters(element, options, forHighlight, ReferencesSearch.search(searchParameters)).forEach(referenceProcessor) }
|
||||
|
||||
if (element is KtElement && !isOnlyKotlinSearch(options.searchScope)) {
|
||||
// TODO: very bad code!! ReferencesSearch does not work correctly for constructors and annotation parameters
|
||||
@@ -294,6 +305,7 @@ abstract class KotlinFindMemberUsagesHandler<T : KtNamedDeclaration> protected c
|
||||
applyQueryFilters(
|
||||
element,
|
||||
options,
|
||||
forHighlight,
|
||||
query
|
||||
).forEach(referenceProcessor)
|
||||
}
|
||||
@@ -323,6 +335,7 @@ abstract class KotlinFindMemberUsagesHandler<T : KtNamedDeclaration> protected c
|
||||
protected abstract fun applyQueryFilters(
|
||||
element: PsiElement,
|
||||
options: FindUsagesOptions,
|
||||
fromHighlighting: Boolean,
|
||||
query: Query<PsiReference>
|
||||
): Query<PsiReference>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user