Fix ExtensionTestUtil compilation for 191; CustomUsageSearcherTest compilation for 201
Relates to #KT-36657
This commit is contained in:
@@ -5,21 +5,30 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.findUsages
|
package org.jetbrains.kotlin.findUsages
|
||||||
|
|
||||||
|
import com.intellij.find.findUsages.CustomUsageSearcher
|
||||||
|
import com.intellij.find.findUsages.FindUsagesOptions
|
||||||
|
import com.intellij.psi.PsiElement
|
||||||
|
import com.intellij.usageView.UsageInfo
|
||||||
|
import com.intellij.usages.Usage
|
||||||
|
import com.intellij.usages.UsageInfo2UsageAdapter
|
||||||
|
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||||
|
import org.jetbrains.kotlin.idea.maskExtensions
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCaseBase
|
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCaseBase
|
||||||
|
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
||||||
|
|
||||||
|
|
||||||
class CustomUsageSearcherTest : KotlinLightCodeInsightFixtureTestCaseBase() {
|
class CustomUsageSearcherTest : KotlinLightCodeInsightFixtureTestCaseBase() {
|
||||||
|
|
||||||
fun testAddCustomUsagesForKotlin() {
|
fun testAddCustomUsagesForKotlin() {
|
||||||
// TODO("[VD] There are diff API for ExtensionTestUtil in 191, 192, 193")
|
val customUsageSearcher = object : CustomUsageSearcher() {
|
||||||
// val customUsageSearcher = object : CustomUsageSearcher() {
|
override fun processElementUsages(element: PsiElement, processor: ProcessorInCompat<Usage>, options: FindUsagesOptions) {
|
||||||
// override fun processElementUsages(element: PsiElement, processor: Processor<Usage>, options: FindUsagesOptions) {
|
runReadAction { processor.process(UsageInfo2UsageAdapter(UsageInfo(element))) }
|
||||||
// runReadAction { processor.process(UsageInfo2UsageAdapter(UsageInfo(element))) }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
maskExtensions(CustomUsageSearcher.EP_NAME, listOf(customUsageSearcher), testRootDisposable)
|
||||||
// // ExtensionTestUtil.maskExtensions(CustomUsageSearcher.EP_NAME, listOf(customUsageSearcher), testRootDisposable)
|
myFixture.configureByText(KotlinFileType.INSTANCE, """val <caret>selfUsed = 1""")
|
||||||
// myFixture.configureByText(KotlinFileType.INSTANCE, """val <caret>selfUsed = 1""")
|
|
||||||
//
|
val usages = myFixture.getUsageViewTreeTextRepresentation(myFixture.elementAtCaret)
|
||||||
// val usages = myFixture.getUsageViewTreeTextRepresentation(myFixture.elementAtCaret)
|
assertTrue(usages.contains("val selfUsed"))
|
||||||
// assertTrue(usages.contains("val selfUsed"))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* 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.findUsages
|
||||||
|
|
||||||
|
import com.intellij.util.Processor
|
||||||
|
|
||||||
|
// BUNCH 193
|
||||||
|
typealias ProcessorInCompat<T> = Processor<T>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* 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.findUsages
|
||||||
|
|
||||||
|
import com.intellij.util.Processor
|
||||||
|
|
||||||
|
// BUNCH 201
|
||||||
|
typealias ProcessorInCompat<T> = Processor<in T>
|
||||||
@@ -6,7 +6,10 @@
|
|||||||
package org.jetbrains.kotlin.idea
|
package org.jetbrains.kotlin.idea
|
||||||
|
|
||||||
import com.intellij.ide.hierarchy.HierarchyTreeStructure
|
import com.intellij.ide.hierarchy.HierarchyTreeStructure
|
||||||
|
import com.intellij.openapi.Disposable
|
||||||
|
import com.intellij.openapi.extensions.ExtensionPointName
|
||||||
import com.intellij.openapi.util.Computable
|
import com.intellij.openapi.util.Computable
|
||||||
|
import com.intellij.testFramework.ExtensionTestUtil
|
||||||
import com.intellij.testFramework.codeInsight.hierarchy.HierarchyViewTestFixture
|
import com.intellij.testFramework.codeInsight.hierarchy.HierarchyViewTestFixture
|
||||||
|
|
||||||
// BUNCH: 193
|
// BUNCH: 193
|
||||||
@@ -18,3 +21,11 @@ fun doHierarchyTestCompat(
|
|||||||
) {
|
) {
|
||||||
HierarchyViewTestFixture.doHierarchyTest(treeStructureComputable.compute(), expectedStructure)
|
HierarchyViewTestFixture.doHierarchyTest(treeStructureComputable.compute(), expectedStructure)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun <T> maskExtensions(
|
||||||
|
pointName: ExtensionPointName<T>,
|
||||||
|
newExtensions: List<T>,
|
||||||
|
parentDisposable: Disposable
|
||||||
|
) {
|
||||||
|
ExtensionTestUtil.maskExtensions(pointName, newExtensions, parentDisposable)
|
||||||
|
}
|
||||||
@@ -6,10 +6,13 @@
|
|||||||
package org.jetbrains.kotlin.idea
|
package org.jetbrains.kotlin.idea
|
||||||
|
|
||||||
import com.intellij.ide.hierarchy.HierarchyTreeStructure
|
import com.intellij.ide.hierarchy.HierarchyTreeStructure
|
||||||
|
import com.intellij.openapi.Disposable
|
||||||
|
import com.intellij.openapi.extensions.ExtensionPointName
|
||||||
import com.intellij.openapi.util.Computable
|
import com.intellij.openapi.util.Computable
|
||||||
|
import com.intellij.testFramework.PlatformTestUtil
|
||||||
import com.intellij.testFramework.codeInsight.hierarchy.HierarchyViewTestFixture
|
import com.intellij.testFramework.codeInsight.hierarchy.HierarchyViewTestFixture
|
||||||
|
|
||||||
// BUNCH: 193
|
// BUNCH: 192
|
||||||
@Suppress("UNUSED_PARAMETER")
|
@Suppress("UNUSED_PARAMETER")
|
||||||
fun doHierarchyTestCompat(
|
fun doHierarchyTestCompat(
|
||||||
hierarchyFixture: HierarchyViewTestFixture,
|
hierarchyFixture: HierarchyViewTestFixture,
|
||||||
@@ -18,3 +21,11 @@ fun doHierarchyTestCompat(
|
|||||||
) {
|
) {
|
||||||
hierarchyFixture.doHierarchyTest(treeStructureComputable.compute(), expectedStructure)
|
hierarchyFixture.doHierarchyTest(treeStructureComputable.compute(), expectedStructure)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun <T> maskExtensions(
|
||||||
|
pointName: ExtensionPointName<T>,
|
||||||
|
newExtensions: List<T>,
|
||||||
|
parentDisposable: Disposable
|
||||||
|
) {
|
||||||
|
PlatformTestUtil.maskExtensions(pointName, newExtensions, parentDisposable)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user