@@ -113,20 +113,11 @@ class MockDebugSession extends DebugSession {
113113 for ( var i = 0 ; i < clientLines . length ; i ++ ) {
114114 var l = this . convertClientLineToDebugger ( clientLines [ i ] ) ;
115115 var verified = false ;
116+
116117 if ( l < lines . length ) {
117- const line = lines [ l - 1 ] . trim ( ) ;
118- // if a line is empty or starts with '+' we don't allow to set a breakpoint but move the breakpoint down
119- if ( line . length == 0 || line . indexOf ( "+" ) == 0 )
120- l ++ ;
121- // if a line starts with '-' we don't allow to set a breakpoint but move the breakpoint up
122- if ( line . indexOf ( "-" ) == 0 )
123- l -- ;
124- // don't set 'verified' to true if the line contains the word 'lazy'
125- // in this case the breakpoint will be verified 'lazy' after hitting it once.
126- if ( line . indexOf ( "lazy" ) < 0 ) {
127- verified = true ; // this breakpoint has been validated
128- }
118+ verified = true ; // this breakpoint has been validated
129119 }
120+
130121 const bp = < DebugProtocol . Breakpoint > new Breakpoint ( verified , this . convertDebuggerLineToClient ( l ) ) ;
131122 bp . id = this . _breakpointId ++ ;
132123 var command = [ "break" , "test.rb:" + bp . line ] ;
@@ -144,13 +135,23 @@ class MockDebugSession extends DebugSession {
144135
145136 protected threadsRequest ( response : DebugProtocol . ThreadsResponse ) : void {
146137
147- // return the default thread
148- response . body = {
149- threads : [
150- new Thread ( MockDebugSession . THREAD_ID , "thread 1" )
151- ]
152- } ;
153- this . sendResponse ( response ) ;
138+ this . rubyProcess . Enqueue ( "thread list\n" ) . then ( ( xml : XMLDocument ) => {
139+ if ( xml . documentElement . nodeName !== "threads" ) {
140+ return ;
141+ }
142+
143+ var threads = new Array < Thread > ( ) ;
144+ for ( let i = 0 ; i < xml . documentElement . childNodes . length ; i ++ ) {
145+ var threadNode = xml . documentElement . childNodes . item ( i ) ;
146+ var threadId = threadNode . attributes . getNamedItem ( "id" ) ;
147+
148+ threads . push ( new Thread ( + threadId . value , "thread_" + threadId . value ) ) ;
149+ }
150+ response . body = {
151+ threads : threads
152+ } ;
153+ this . sendResponse ( response ) ;
154+ } ) ;
154155 }
155156
156157 // Called by VS Code after a StoppedEvent
0 commit comments