From a9fa41a46a90c93ef55871d2686f1e6c3d1fbc45 Mon Sep 17 00:00:00 2001 From: Alexey Merkulov Date: Fri, 17 Feb 2023 20:16:27 +0100 Subject: [PATCH] [IFT] Remove mentioning line from the Run-to-Cursor task in the Debug lesson It is not supported in the new UI now IJ-CR-103403 GitOrigin-RevId: 788a9218796e8cf2d40c1a0261b95cb2ab1f52ff --- .../res/messages/LessonsBundle.properties | 1 - .../lesson/general/run/CommonDebugLesson.kt | 32 +------------------ 2 files changed, 1 insertion(+), 32 deletions(-) diff --git a/plugins/ide-features-trainer/res/messages/LessonsBundle.properties b/plugins/ide-features-trainer/res/messages/LessonsBundle.properties index a3459463af01..d9c381293a51 100644 --- a/plugins/ide-features-trainer/res/messages/LessonsBundle.properties +++ b/plugins/ide-features-trainer/res/messages/LessonsBundle.properties @@ -395,7 +395,6 @@ debug.workflow.mute.breakpoints=Oops, the same breakpoint again. Now we don''t n debug.workflow.run.to.cursor.intro=Let''s check the result of {0}. We''ve moved the editor cursor to the {1} statement. debug.workflow.run.to.cursor.press=Press {0}. debug.workflow.run.to.cursor.press.or.click=Press {0} or click {1}. -debug.workflow.run.to.cursor.alternative=Alternatively, click the line number. Note that {0} works even if breakpoints are muted. debug.workflow.evaluate.expression=It seems that the exception is thrown as the result of the selected function call. Let's evaluate it to check the guess. \ Copy the selected expression and paste it into the highlighted text field. debug.workflow.evaluate.it=Press {0} to evaluate the expression. diff --git a/plugins/ide-features-trainer/src/training/learn/lesson/general/run/CommonDebugLesson.kt b/plugins/ide-features-trainer/src/training/learn/lesson/general/run/CommonDebugLesson.kt index 42e94bbc72e2..344aa26cf941 100644 --- a/plugins/ide-features-trainer/src/training/learn/lesson/general/run/CommonDebugLesson.kt +++ b/plugins/ide-features-trainer/src/training/learn/lesson/general/run/CommonDebugLesson.kt @@ -7,13 +7,10 @@ import com.intellij.execution.ui.UIExperiment import com.intellij.icons.AllIcons import com.intellij.ide.ui.text.ShortcutsRenderingUtil import com.intellij.idea.ActionsBundle -import com.intellij.openapi.actionSystem.CommonDataKeys -import com.intellij.openapi.actionSystem.DataProvider import com.intellij.openapi.actionSystem.impl.ActionButton import com.intellij.openapi.application.invokeLater import com.intellij.openapi.application.runWriteAction import com.intellij.openapi.editor.LogicalPosition -import com.intellij.openapi.editor.ex.EditorGutterComponentEx import com.intellij.openapi.editor.impl.EditorComponentImpl import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.psi.PsiDocumentManager @@ -42,8 +39,6 @@ import training.statistic.LessonStartingWay import training.ui.LearningUiHighlightingManager import training.ui.LearningUiUtil.findComponentWithTimeout import training.util.WeakReferenceDelegator -import training.util.getActionById -import java.awt.Rectangle import java.awt.event.KeyEvent abstract class CommonDebugLesson(id: String) : KLesson(id, LessonsBundle.message("debug.workflow.lesson.name")) { @@ -322,19 +317,6 @@ abstract class CommonDebugLesson(id: String) : KLesson(id, LessonsBundle.message val position = sample.getPosition(3) caret(position) - highlightLineNumberByOffset(position.startOffset) - task { - if (!UIExperiment.isNewDebuggerUIEnabled()) { - val runToCursorAction = getActionById("RunToCursor") - triggerAndFullHighlight { - usePulsation = true - clearPreviousHighlights = false - }.component { ui: ActionButton -> - ui.action == runToCursorAction && LessonUtil.checkToolbarIsShowing(ui) - } - } - } - actionTask("RunToCursor") { proposeRestore { checkPositionOfEditor(LessonSample(afterFixText, position)) @@ -344,8 +326,7 @@ abstract class CommonDebugLesson(id: String) : KLesson(id, LessonsBundle.message LessonsBundle.message("debug.workflow.run.to.cursor.press.or.click", action(it), icon(AllIcons.Actions.RunToCursor)) } else LessonsBundle.message("debug.workflow.run.to.cursor.press", action(it)) - val alternative = LessonsBundle.message("debug.workflow.run.to.cursor.alternative", LessonUtil.actionName(it)) - "$intro $actionPart $alternative" + "$intro $actionPart" } } @@ -403,17 +384,6 @@ abstract class CommonDebugLesson(id: String) : KLesson(id, LessonsBundle.message protected open fun LessonContext.restoreHotSwapStateInformer() = Unit - private fun LessonContext.highlightLineNumberByOffset(offset: Int) { - task { - triggerAndBorderHighlight().componentPart l@{ ui: EditorGutterComponentEx -> - if (CommonDataKeys.EDITOR.getData(ui as DataProvider) != editor) return@l null - val line = editor.offsetToVisualLine(offset, true) - val y = editor.visualLineToY(line) - return@l Rectangle(2, y, ui.iconsAreaWidth + 6, editor.lineHeight) - } - } - } - private fun LessonContext.quickEvaluateTask(positionId: Int, textAndRestore: TaskContext.(LessonSamplePosition) -> Unit) { task("QuickEvaluateExpression") { before {