@@ -4,30 +4,14 @@ import com.intellij.execution.configurations.RunProfile
4
4
import com.intellij.execution.configurations.RunProfileState
5
5
import com.intellij.execution.configurations.RunnerSettings
6
6
import com.intellij.execution.executors.DefaultDebugExecutor
7
- import com.intellij.execution.process.ProcessEvent
8
- import com.intellij.execution.process.ProcessListener
9
7
import com.intellij.execution.runners.ExecutionEnvironment
10
8
import com.intellij.execution.runners.GenericProgramRunner
11
- import com.intellij.execution.ui.ExecutionConsole
12
9
import com.intellij.execution.ui.RunContentDescriptor
13
- import com.intellij.execution.ui.RunnerLayoutUi
14
- import com.intellij.execution.ui.layout.PlaceInGrid
15
- import com.intellij.icons.AllIcons
16
- import com.intellij.openapi.Disposable
17
- import com.intellij.openapi.application.ApplicationManager
18
- import com.intellij.openapi.util.Key
19
- import com.intellij.ui.content.Content
20
- import com.intellij.util.Alarm
21
- import com.intellij.xdebugger.*
22
- import com.intellij.xdebugger.breakpoints.XBreakpointHandler
23
- import com.intellij.xdebugger.breakpoints.XBreakpointProperties
24
- import com.intellij.xdebugger.breakpoints.XLineBreakpoint
25
- import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider
26
- import com.intellij.xdebugger.frame.XSuspendContext
27
- import com.intellij.xdebugger.ui.XDebugTabLayouter
10
+ import com.intellij.xdebugger.XDebugProcess
11
+ import com.intellij.xdebugger.XDebugProcessStarter
12
+ import com.intellij.xdebugger.XDebugSession
13
+ import com.intellij.xdebugger.XDebuggerManager
28
14
import com.phodal.shirelang.run.ShireConfiguration
29
- import com.phodal.shirelang.run.ShireConsoleView
30
- import com.phodal.shirelang.run.ShireRunListener
31
15
32
16
// / refs to: https://github.com/KronicDeth/intellij-elixir/pull/643/files#diff-b1ba5c87ca6f66a455e4c1539cb2d99a62722d067a3d9e8043b290426cea5470
33
17
class ShireDebugRunner : GenericProgramRunner <RunnerSettings >() {
@@ -47,145 +31,4 @@ class ShireDebugRunner : GenericProgramRunner<RunnerSettings>() {
47
31
}
48
32
}).runContentDescriptor
49
33
}
50
- }
51
-
52
- class ShireDebugProcess (private val session : XDebugSession , private val environment : ExecutionEnvironment ) :
53
- XDebugProcess (session), Disposable {
54
- private val connection = ApplicationManager .getApplication().messageBus.connect(this )
55
- private val myRequestsScheduler: Alarm
56
-
57
- init {
58
- session.addSessionListener(object : XDebugSessionListener {
59
- override fun stackFrameChanged () {
60
-
61
- }
62
-
63
- override fun sessionPaused () {
64
-
65
- }
66
- })
67
-
68
- session.positionReached(ShireSuspendContext (this @ShireDebugProcess, session.project))
69
- connection.subscribe(ShireRunListener .TOPIC , object : ShireRunListener {
70
- override fun runFinish (
71
- allOutput : String ,
72
- llmOutput : String ,
73
- event : ProcessEvent ,
74
- scriptPath : String ,
75
- consoleView : ShireConsoleView ? ,
76
- ) {
77
- this @ShireDebugProcess.stop()
78
- }
79
- })
80
-
81
- myRequestsScheduler = Alarm (Alarm .ThreadToUse .POOLED_THREAD , this )
82
- }
83
-
84
- // override fun createConsole(): ExecutionConsole = debuggedExecutionResult.executionConsole
85
-
86
- private val debuggableConfiguration: ShireConfiguration get() = session.runProfile as ShireConfiguration
87
-
88
- private val breakpointHandlers = arrayOf<XBreakpointHandler <* >>(ShireBreakpointHandler (this ))
89
- override fun getBreakpointHandlers (): Array <XBreakpointHandler <* >> = breakpointHandlers
90
-
91
- override fun createTabLayouter (): XDebugTabLayouter = ShireDebugTabLayouter ()
92
-
93
- override fun resume (context : XSuspendContext ? ) {
94
-
95
- }
96
-
97
- fun start () {
98
- environment.executor.let { executor ->
99
- debuggableConfiguration
100
- .getState(executor, environment)
101
- .execute(executor, environment.runner)!!
102
- }
103
-
104
- processHandler.addProcessListener(object : ProcessListener {
105
- override fun onTextAvailable (event : ProcessEvent , outputType : Key <* >) {
106
- super .onTextAvailable(event, outputType)
107
- }
108
-
109
- override fun processTerminated (event : ProcessEvent ) {
110
- super .processTerminated(event)
111
- stop()
112
- }
113
- })
114
- }
115
-
116
- override fun startStepOut (context : XSuspendContext ? ) {
117
-
118
- }
119
-
120
- override fun startStepInto (context : XSuspendContext ? ) {
121
-
122
- }
123
-
124
- override fun startStepOver (context : XSuspendContext ? ) {
125
-
126
- }
127
-
128
- override fun startForceStepInto (context : XSuspendContext ? ) {
129
-
130
- }
131
-
132
- override fun startPausing () {
133
-
134
- }
135
-
136
- override fun stop () {
137
- connection.disconnect()
138
- processHandler.destroyProcess()
139
- session.stop()
140
- }
141
-
142
- override fun dispose () {
143
- connection.disconnect()
144
- }
145
-
146
- fun addBreakpoint (breakpoint : XLineBreakpoint <ShireBpProperties >) {
147
-
148
- }
149
-
150
- fun removeBreakpoint (breakpoint : XLineBreakpoint <ShireBpProperties >) {
151
-
152
- }
153
-
154
- override fun getEditorsProvider (): XDebuggerEditorsProvider {
155
- return ShireDebuggerEditorsProvider ()
156
- }
157
- }
158
-
159
- class ShireDebugTabLayouter : XDebugTabLayouter () {
160
- override fun registerConsoleContent (ui : RunnerLayoutUi , console : ExecutionConsole ): Content {
161
- val content = ui
162
- .createContent(
163
- " DebuggedConsoleContent" , console.component, " Shire Debugged Console" ,
164
- AllIcons .Debugger .Console , console.preferredFocusableComponent
165
- )
166
-
167
- content.isCloseable = false
168
- ui.addContent(content, 1 , PlaceInGrid .bottom, false )
169
- return content
170
- }
171
- }
172
-
173
-
174
- class ShireBreakpointHandler (val process : ShireDebugProcess ) :
175
- XBreakpointHandler <XLineBreakpoint <ShireBpProperties >>(ShireLineBreakpointType ::class .java) {
176
- override fun registerBreakpoint (breakpoint : XLineBreakpoint <ShireBpProperties >) {
177
- process.addBreakpoint(breakpoint)
178
- }
179
-
180
- override fun unregisterBreakpoint (breakpoint : XLineBreakpoint <ShireBpProperties >, temporary : Boolean ) {
181
- process.removeBreakpoint(breakpoint)
182
- }
183
- }
184
-
185
- class ShireBpProperties : XBreakpointProperties <ShireBpProperties >() {
186
- override fun getState (): ShireBpProperties = this
187
- override fun loadState (state : ShireBpProperties ) {}
188
- }
189
-
190
-
191
- val RUNNER_ID : String = " ShireProgramRunner"
34
+ }
0 commit comments