diff --git a/plugins/kotlin/features-trainer/resources/messages/KotlinLessonsBundle.properties b/plugins/kotlin/features-trainer/resources/messages/KotlinLessonsBundle.properties index 8db50c90fb45..5548f04a832d 100644 --- a/plugins/kotlin/features-trainer/resources/messages/KotlinLessonsBundle.properties +++ b/plugins/kotlin/features-trainer/resources/messages/KotlinLessonsBundle.properties @@ -7,7 +7,7 @@ kotlin.onboarding.invoke.intention.for.warning.1=You have just fixed a bug, but IntelliJ IDEA highlights and adds a yellow bulb to the code lines that can be improved. kotlin.onboarding.invoke.intention.for.warning.2=Press {0} to preview the warnings and apply a quick-fix. kotlin.onboarding.invoke.intention.for.warning.balloon=Press {0} to show available quick-fixes -kotlin.onboarding.select.fix=Apply the first item: {0}. In this case, the for-each loop will make code easier to understand. +kotlin.onboarding.select.fix=Apply the {0} quick-fix. It will remove the unused local variable. kotlin.onboarding.invoke.intention.for.code=Intentions also save your time and make coding easier. Let''s use an intention to reformat string concatenation. \ Press {0} to show possible options. kotlin.onboarding.invoke.intention.for.code.balloon=Press {0} to show available intentions diff --git a/plugins/kotlin/features-trainer/src/org/jetbrains/kotlin/training/ift/lesson/essential/KotlinOnboardingTourLesson.kt b/plugins/kotlin/features-trainer/src/org/jetbrains/kotlin/training/ift/lesson/essential/KotlinOnboardingTourLesson.kt index 84ceb6039c5d..552fbd27f2a3 100644 --- a/plugins/kotlin/features-trainer/src/org/jetbrains/kotlin/training/ift/lesson/essential/KotlinOnboardingTourLesson.kt +++ b/plugins/kotlin/features-trainer/src/org/jetbrains/kotlin/training/ift/lesson/essential/KotlinOnboardingTourLesson.kt @@ -6,6 +6,7 @@ import com.intellij.java.ift.lesson.essential.OnboardingTourLessonBase import com.intellij.java.ift.lesson.essential.ideaOnboardingLessonId import com.intellij.openapi.ui.popup.Balloon import org.jetbrains.annotations.Nls +import org.jetbrains.kotlin.idea.base.highlighting.KotlinBaseHighlightingBundle import org.jetbrains.kotlin.idea.base.resources.KotlinBundle import org.jetbrains.kotlin.training.ift.KotlinLessonsBundle import training.dsl.* @@ -18,8 +19,9 @@ class KotlinOnboardingTourLesson : OnboardingTourLessonBase(ideaOnboardingLesson private val samplePrintln = "println(\"AVERAGE of array \" + array.joinToString() + \" is \" + findAverage(array))" override val sample: LessonSample = parseLessonSample(""" fun findAverage(values: IntArray): Double { + val size = values.size var result = 0.0 - for (i in 0 until values.size) { + for (i in 0 until values.size) { result += values[i] } return result @@ -34,11 +36,11 @@ class KotlinOnboardingTourLesson : OnboardingTourLessonBase(ideaOnboardingLesson override val completionStepExpectedCompletion: String = "size" override fun LessonContext.contextActions() { - val quickFixMessage = KotlinBundle.message("replace.index.loop.with.collection.loop.quick.fix.text") + val quickFixMessage = KotlinBaseHighlightingBundle.message("safe.delete.text.0", "size") caret(sample.getPosition(3)) task { - triggerOnEditorText("until", highlightBorder = true) + triggerOnEditorText("size", highlightBorder = true) } task("ShowIntentionActions") { @@ -55,9 +57,8 @@ class KotlinOnboardingTourLesson : OnboardingTourLessonBase(ideaOnboardingLesson task { text(KotlinLessonsBundle.message("kotlin.onboarding.select.fix", strong(quickFixMessage))) stateCheck { - editor.document.text.contains("for (element in values)") + !editor.document.text.contains("size = values") } - restoreByUi(delayMillis = defaultRestoreDelay) } fun getIntentionMessage(): @Nls String {