@@ -406,44 +406,42 @@ export class ObjectScriptDebugSession extends LoggingDebugSession {
406406 const stack = await this . _connection . sendStackGetCommand ( ) ;
407407
408408 const stackFrames = await Promise . all (
409- stack . stack . map (
410- async ( stackFrame : xdebug . StackFrame , index ) : Promise < StackFrame > => {
411- const [ , namespace , name ] = decodeURI ( stackFrame . fileUri ) . match ( / ^ d b g p : \/ \/ \| ( [ ^ | ] + ) \| ( .* ) $ / ) ;
412- const routine = name ;
413- // const routine = name.includes(".") ? name : name + ".int";
414- const fileUri = DocumentContentProvider . getUri ( routine , this . _workspace , namespace ) . toString ( ) ;
415- const source = new Source ( routine , fileUri ) ;
416- let line = stackFrame . line + 1 ;
417- const place = `${ stackFrame . method } +${ stackFrame . methodOffset } ` ;
418- const stackFrameId = this . _stackFrameIdCounter ++ ;
419- let noSource = false ;
420- try {
421- const document = await vscode . workspace . openTextDocument ( vscode . Uri . parse ( source . path ) ) ;
422- if ( source . name . endsWith ( ".cls" ) && stackFrame . method !== "" ) {
423- const methodMatchPattern = new RegExp ( `^(Class)?Method ${ stackFrame . method } (?=[( ])` , "i" ) ;
424- for ( let i = 0 ; i < document . lineCount ; i ++ ) {
425- const codeLine = document . lineAt ( i ) ;
426-
427- const methodMatch = codeLine . text . match ( methodMatchPattern ) ;
428- if ( methodMatch ) {
429- line = i + 2 + stackFrame . methodOffset ;
430- break ;
431- }
409+ stack . stack . map ( async ( stackFrame : xdebug . StackFrame , index ) : Promise < StackFrame > => {
410+ const [ , namespace , name ] = decodeURI ( stackFrame . fileUri ) . match ( / ^ d b g p : \/ \/ \| ( [ ^ | ] + ) \| ( .* ) $ / ) ;
411+ const routine = name ;
412+ // const routine = name.includes(".") ? name : name + ".int";
413+ const fileUri = DocumentContentProvider . getUri ( routine , this . _workspace , namespace ) . toString ( ) ;
414+ const source = new Source ( routine , fileUri ) ;
415+ let line = stackFrame . line + 1 ;
416+ const place = `${ stackFrame . method } +${ stackFrame . methodOffset } ` ;
417+ const stackFrameId = this . _stackFrameIdCounter ++ ;
418+ let noSource = false ;
419+ try {
420+ const document = await vscode . workspace . openTextDocument ( vscode . Uri . parse ( source . path ) ) ;
421+ if ( source . name . endsWith ( ".cls" ) && stackFrame . method !== "" ) {
422+ const methodMatchPattern = new RegExp ( `^(Class)?Method ${ stackFrame . method } (?=[( ])` , "i" ) ;
423+ for ( let i = 0 ; i < document . lineCount ; i ++ ) {
424+ const codeLine = document . lineAt ( i ) ;
425+
426+ const methodMatch = codeLine . text . match ( methodMatchPattern ) ;
427+ if ( methodMatch ) {
428+ line = i + 2 + stackFrame . methodOffset ;
429+ break ;
432430 }
433431 }
434- this . _stackFrames . set ( stackFrameId , stackFrame ) ;
435- } catch ( ex ) {
436- noSource = true ;
437432 }
438- return {
439- id : stackFrameId ,
440- name : place ,
441- source : noSource ? null : source ,
442- line,
443- column : 1 ,
444- } ;
433+ this . _stackFrames . set ( stackFrameId , stackFrame ) ;
434+ } catch ( ex ) {
435+ noSource = true ;
445436 }
446- )
437+ return {
438+ id : stackFrameId ,
439+ name : place ,
440+ source : noSource ? null : source ,
441+ line,
442+ column : 1 ,
443+ } ;
444+ } )
447445 ) ;
448446
449447 response . body = {
0 commit comments