From be0cde1d7044b05647ee5c9f7d2ca04abb2d1be5 Mon Sep 17 00:00:00 2001 From: Andrei Klunnyi Date: Tue, 14 Jul 2020 11:52:24 +0200 Subject: [PATCH] KT-32368 Rework Inline hints settings // remove suspending call hints Suspending call hints were removed according to KT-30928 and KT-39271. --- .../kotlin/generators/tests/GenerateTests.kt | 5 -- idea/resources/META-INF/plugin-common.xml | 1 - .../KotlinSuspendingCallHintsProvider.kt | 46 ------------------- .../hints/suspending/SimpleCase.kt | 5 -- ...ctKotlinSuspendingCallHintsProviderTest.kt | 34 -------------- ...pendingCallHintsProviderTestGenerated.java | 35 -------------- 6 files changed, 126 deletions(-) delete mode 100644 idea/src/org/jetbrains/kotlin/idea/codeInsight/hints/KotlinSuspendingCallHintsProvider.kt delete mode 100644 idea/testData/codeInsight/hints/suspending/SimpleCase.kt delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/codeInsight/hints/AbstractKotlinSuspendingCallHintsProviderTest.kt delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/codeInsight/hints/KotlinSuspendingCallHintsProviderTestGenerated.java diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index f829bb74873..20119225d86 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -47,7 +47,6 @@ import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateTestSuppor import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateToStringActionTest import org.jetbrains.kotlin.idea.codeInsight.hints.AbstractKotlinLambdasHintsProvider import org.jetbrains.kotlin.idea.codeInsight.hints.AbstractKotlinReferenceTypeHintsProviderTest -import org.jetbrains.kotlin.idea.codeInsight.hints.AbstractKotlinSuspendingCallHintsProviderTest import org.jetbrains.kotlin.idea.codeInsight.moveUpDown.AbstractMoveLeftRightTest import org.jetbrains.kotlin.idea.codeInsight.moveUpDown.AbstractMoveStatementTest import org.jetbrains.kotlin.idea.codeInsight.postfix.AbstractPostfixTemplateProviderTest @@ -882,10 +881,6 @@ fun main(args: Array) { model("codeInsight/codeVision") } - testClass { - model("codeInsight/hints/suspending") - } - testClass { model("codeInsight/hints/types") } diff --git a/idea/resources/META-INF/plugin-common.xml b/idea/resources/META-INF/plugin-common.xml index bc646597c8b..7599bd96ad9 100644 --- a/idea/resources/META-INF/plugin-common.xml +++ b/idea/resources/META-INF/plugin-common.xml @@ -377,7 +377,6 @@ - diff --git a/idea/src/org/jetbrains/kotlin/idea/codeInsight/hints/KotlinSuspendingCallHintsProvider.kt b/idea/src/org/jetbrains/kotlin/idea/codeInsight/hints/KotlinSuspendingCallHintsProvider.kt deleted file mode 100644 index 3dff2163722..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/codeInsight/hints/KotlinSuspendingCallHintsProvider.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.idea.codeInsight.hints - -import com.intellij.codeInsight.hints.ChangeListener -import com.intellij.codeInsight.hints.ImmediateConfigurable -import com.intellij.ui.layout.panel -import org.jetbrains.kotlin.idea.KotlinBundle -import javax.swing.JComponent - -@Suppress("UnstableApiUsage") -class KotlinSuspendingCallHintsProvider : KotlinAbstractHintsProvider() { - - data class Settings(var suspendingCalls: Boolean = false) - - override val name: String = KotlinBundle.message("hints.settings.suspending") - - override fun createConfigurable(settings: Settings): ImmediateConfigurable { - return object : ImmediateConfigurable { - override fun createComponent(listener: ChangeListener): JComponent = panel {} - - override val mainCheckboxText: String = KotlinBundle.message("hints.settings.common.items") - - override val cases: List - get() = listOf( - ImmediateConfigurable.Case( - KotlinBundle.message("hints.settings.suspending"), - "hints.suspending.calls", - settings::suspendingCalls - ) - ) - } - } - - override fun createSettings(): Settings = Settings() - - override fun isElementSupported(resolved: HintType?, settings: Settings): Boolean { - return when (resolved) { - HintType.SUSPENDING_CALL -> settings.suspendingCalls - else -> false - } - } -} \ No newline at end of file diff --git a/idea/testData/codeInsight/hints/suspending/SimpleCase.kt b/idea/testData/codeInsight/hints/suspending/SimpleCase.kt deleted file mode 100644 index 7159a9dd9dc..00000000000 --- a/idea/testData/codeInsight/hints/suspending/SimpleCase.kt +++ /dev/null @@ -1,5 +0,0 @@ -import kotlin.coroutines.experimental.buildSequence - -val x = buildSequence { - <# # #>yield(1) -} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/hints/AbstractKotlinSuspendingCallHintsProviderTest.kt b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/hints/AbstractKotlinSuspendingCallHintsProviderTest.kt deleted file mode 100644 index 37e87191da5..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/hints/AbstractKotlinSuspendingCallHintsProviderTest.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.idea.codeInsight.hints - -import com.intellij.openapi.util.io.FileUtil -import com.intellij.testFramework.LightProjectDescriptor -import com.intellij.testFramework.utils.inlays.InlayHintsProviderTestCase -import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor -import org.jetbrains.kotlin.test.InTextDirectivesUtils -import java.io.File - -@Suppress("UnstableApiUsage") -abstract class AbstractKotlinSuspendingCallHintsProviderTest : - InlayHintsProviderTestCase() { // Abstract- prefix is just a convention for GenerateTests - - override fun getProjectDescriptor(): LightProjectDescriptor { - return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE - } - - fun doTest(testPath: String) { // named according to the convention imposed by GenerateTests - assertThatActualHintsMatch(testPath) - } - - private fun assertThatActualHintsMatch(fileName: String) { - with(KotlinSuspendingCallHintsProvider()) { - val fileContents = FileUtil.loadFile(File(fileName), true) - val settings = createSettings().apply { suspendingCalls = true } - testProvider("KotlinSuspendingCallHintsProvider.kt", fileContents, this, settings) - } - } -} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/hints/KotlinSuspendingCallHintsProviderTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/hints/KotlinSuspendingCallHintsProviderTestGenerated.java deleted file mode 100644 index cc17b741663..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/hints/KotlinSuspendingCallHintsProviderTestGenerated.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.idea.codeInsight.hints; - -import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; -import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; - -import java.io.File; -import java.util.regex.Pattern; - -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ -@SuppressWarnings("all") -@TestMetadata("idea/testData/codeInsight/hints/suspending") -@TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) -public class KotlinSuspendingCallHintsProviderTestGenerated extends AbstractKotlinSuspendingCallHintsProviderTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInSuspending() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/codeInsight/hints/suspending"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @TestMetadata("SimpleCase.kt") - public void testSimpleCase() throws Exception { - runTest("idea/testData/codeInsight/hints/suspending/SimpleCase.kt"); - } -}