From b0bb6778eb8fffd6194fb2deb899bd4c9c572f79 Mon Sep 17 00:00:00 2001 From: Friedrich von Never Date: Thu, 29 Aug 2024 00:00:12 +0200 Subject: [PATCH] (#319) Debug Previewer: add an action skeleton --- .../idea/editor/AvaloniaPreviewEditorBase.kt | 2 +- .../idea/editor/actions/DebugPreviewerAction.kt | 16 ++++++++++++++-- .../messages/AvaloniaRiderBundle.properties | 2 ++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/rider/main/kotlin/me/fornever/avaloniarider/idea/editor/AvaloniaPreviewEditorBase.kt b/src/rider/main/kotlin/me/fornever/avaloniarider/idea/editor/AvaloniaPreviewEditorBase.kt index 47b1122..3c032e6 100644 --- a/src/rider/main/kotlin/me/fornever/avaloniarider/idea/editor/AvaloniaPreviewEditorBase.kt +++ b/src/rider/main/kotlin/me/fornever/avaloniarider/idea/editor/AvaloniaPreviewEditorBase.kt @@ -184,7 +184,7 @@ abstract class AvaloniaPreviewEditorBase( add(RestartPreviewerAction(lifetime, sessionController, selectedProjectPath)) addAll(*actions) add(TogglePreviewerLogAction(isLogManuallyVisible)) - add(DebugPreviewerAction()) + add(DebugPreviewerAction(lifetime)) } val toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.EDITOR_TOOLBAR, actionGroup, true).apply { diff --git a/src/rider/main/kotlin/me/fornever/avaloniarider/idea/editor/actions/DebugPreviewerAction.kt b/src/rider/main/kotlin/me/fornever/avaloniarider/idea/editor/actions/DebugPreviewerAction.kt index 88bc9c1..ef70b9f 100644 --- a/src/rider/main/kotlin/me/fornever/avaloniarider/idea/editor/actions/DebugPreviewerAction.kt +++ b/src/rider/main/kotlin/me/fornever/avaloniarider/idea/editor/actions/DebugPreviewerAction.kt @@ -1,12 +1,21 @@ package me.fornever.avaloniarider.idea.editor.actions +import com.intellij.icons.AllIcons import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent +import com.jetbrains.rd.util.lifetime.Lifetime +import kotlinx.coroutines.launch +import me.fornever.avaloniarider.AvaloniaRiderBundle import me.fornever.avaloniarider.idea.settings.AvaloniaApplicationSettings -class DebugPreviewerAction : AnAction() { +class DebugPreviewerAction(private val lifetime: Lifetime) : AnAction( + AvaloniaRiderBundle.messagePointer("action.debug-previewer.text"), + AvaloniaRiderBundle.messagePointer("action.debug-previewer.description"), + AllIcons.Debugger.Console +) { override fun getActionUpdateThread() = ActionUpdateThread.BGT + override fun update(e: AnActionEvent) { val presentation = e.presentation if (!AvaloniaApplicationSettings.getInstance().isDeveloperModeEnabled) { @@ -18,6 +27,9 @@ class DebugPreviewerAction : AnAction() { } override fun actionPerformed(p0: AnActionEvent) { - + lifetime.coroutineScope.launch { + TODO("Get the debugger process startup command") + TODO("Start the debug session") + } } } diff --git a/src/rider/main/resources/messages/AvaloniaRiderBundle.properties b/src/rider/main/resources/messages/AvaloniaRiderBundle.properties index 73047dd..065c769 100644 --- a/src/rider/main/resources/messages/AvaloniaRiderBundle.properties +++ b/src/rider/main/resources/messages/AvaloniaRiderBundle.properties @@ -31,3 +31,5 @@ settings.synchronizeWithRunConfiguration=Synchronize the current run configurati settings.workingDirectory.definedByMsBuild=Defined by MSBuild settings.workingDirectory.solutionDirectory=Solution directory settings.workingDirectory=Previewer working directory: +action.debug-previewer.text=Debug Previewer +action.debug-previewer.description=Starts previewer under debugger.