Add Kotlin DeprecationLevel into the REPL completion

This commit is contained in:
Ilya Muradyan
2021-05-05 02:49:30 +03:00
committed by TeamCityServer
parent 6bc4e124fb
commit e9af2849ef
4 changed files with 57 additions and 7 deletions
@@ -127,6 +127,39 @@ class ReplCompletionAndErrorsAnalysisTest : TestCase() {
}
}
@Test
fun testDeprecatedCompletion() = test {
run {
doCompile
code = """
@Deprecated("deprecated")
class Clazz1
@Deprecated("deprecated", level=DeprecationLevel.ERROR)
class Clazz2
""".trimIndent()
}
run {
doComplete
code = """
@Deprecated("deprecated1", level=DeprecationLevel.WA)
class Clazz3
@Deprecated("deprecated1", level=kotlin.annotation.AnnotationRetention.SOURCE)
class Clazz4
Claz
""".trimIndent()
cursor = code.length
expect {
addCompletion("Clazz3", "Clazz3", " (Line_2_simplescript)", "class", DeprecationLevel.WARNING)
addCompletion("Clazz4", "Clazz4", " (Line_2_simplescript)", "class", DeprecationLevel.WARNING)
addCompletion("Clazz1", "Clazz1", " (Line_1_simplescript)", "class", DeprecationLevel.WARNING)
addCompletion("Clazz2", "Clazz2", " (Line_1_simplescript)", "class", DeprecationLevel.ERROR)
}
}
}
@Test
fun testExtensionMethods() = test {
run {
@@ -72,8 +72,8 @@ class TestConf {
class Expected(private val run: Run) {
val completions = ExpectedList<SourceCodeCompletionVariant>(run::doComplete)
fun addCompletion(text: String, displayText: String, tail: String, icon: String) {
completions.add(SourceCodeCompletionVariant(text, displayText, tail, icon))
fun addCompletion(text: String, displayText: String, tail: String, icon: String, deprecationLevel: DeprecationLevel? = null) {
completions.add(SourceCodeCompletionVariant(text, displayText, tail, icon, deprecationLevel))
}
val errors = ExpectedList<ScriptDiagnostic>(run::doErrorCheck)