Skip to content

Commit

Permalink
(#319) Debug Previewer: add an action skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed Aug 28, 2024
1 parent dfe3b25 commit b0bb677
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit b0bb677

Please sign in to comment.