@@ -621,47 +621,45 @@ class PhpDebugSession extends vscode.DebugSession {
621621 response . body = { stackFrames : [ { id, name, source, line, column : 1 } ] }
622622 } else {
623623 response . body = {
624- stackFrames : stack . map (
625- ( stackFrame ) : VSCodeDebugProtocol . StackFrame => {
626- let source : VSCodeDebugProtocol . Source
627- let line = stackFrame . line
628- const urlObject = url . parse ( stackFrame . fileUri )
629- if ( urlObject . protocol === 'dbgp:' ) {
630- let sourceReference
631- const src = Array . from ( this . _sources ) . find (
632- ( [ , v ] ) => v . url === stackFrame . fileUri && v . connection === connection
633- )
634- if ( src ) {
635- sourceReference = src [ 0 ]
636- } else {
637- sourceReference = this . _sourceIdCounter ++
638- this . _sources . set ( sourceReference , { connection, url : stackFrame . fileUri } )
639- }
640- // for eval code, we need to include .php extension to get syntax highlighting
641- source = {
642- name :
643- stackFrame . type === 'eval'
644- ? `eval ${ stackFrame . fileUri . substr ( 7 ) } .php`
645- : stackFrame . name ,
646- sourceReference,
647- origin : stackFrame . type ,
648- }
649- // for eval code, we add a "<?php" line at the beginning to get syntax highlighting (see sourceRequest)
650- line ++
624+ stackFrames : stack . map ( ( stackFrame ) : VSCodeDebugProtocol . StackFrame => {
625+ let source : VSCodeDebugProtocol . Source
626+ let line = stackFrame . line
627+ const urlObject = url . parse ( stackFrame . fileUri )
628+ if ( urlObject . protocol === 'dbgp:' ) {
629+ let sourceReference
630+ const src = Array . from ( this . _sources ) . find (
631+ ( [ , v ] ) => v . url === stackFrame . fileUri && v . connection === connection
632+ )
633+ if ( src ) {
634+ sourceReference = src [ 0 ]
651635 } else {
652- // Xdebug paths are URIs, VS Code file paths
653- const filePath = convertDebuggerPathToClient ( urlObject , this . _args . pathMappings )
654- // "Name" of the source and the actual file path
655- source = { name : path . basename ( filePath ) , path : filePath }
636+ sourceReference = this . _sourceIdCounter ++
637+ this . _sources . set ( sourceReference , { connection, url : stackFrame . fileUri } )
638+ }
639+ // for eval code, we need to include .php extension to get syntax highlighting
640+ source = {
641+ name :
642+ stackFrame . type === 'eval'
643+ ? `eval ${ stackFrame . fileUri . substr ( 7 ) } .php`
644+ : stackFrame . name ,
645+ sourceReference,
646+ origin : stackFrame . type ,
656647 }
657- // a new, unique ID for scopeRequests
658- const stackFrameId = this . _stackFrameIdCounter ++
659- // save the connection this stackframe belongs to and the level of the stackframe under the stacktrace id
660- this . _stackFrames . set ( stackFrameId , stackFrame )
661- // prepare response for VS Code (column is always 1 since Xdebug doesn't tell us the column)
662- return { id : stackFrameId , name : stackFrame . name , source, line, column : 1 }
648+ // for eval code, we add a "<?php" line at the beginning to get syntax highlighting (see sourceRequest)
649+ line ++
650+ } else {
651+ // Xdebug paths are URIs, VS Code file paths
652+ const filePath = convertDebuggerPathToClient ( urlObject , this . _args . pathMappings )
653+ // "Name" of the source and the actual file path
654+ source = { name : path . basename ( filePath ) , path : filePath }
663655 }
664- ) ,
656+ // a new, unique ID for scopeRequests
657+ const stackFrameId = this . _stackFrameIdCounter ++
658+ // save the connection this stackframe belongs to and the level of the stackframe under the stacktrace id
659+ this . _stackFrames . set ( stackFrameId , stackFrame )
660+ // prepare response for VS Code (column is always 1 since Xdebug doesn't tell us the column)
661+ return { id : stackFrameId , name : stackFrame . name , source, line, column : 1 }
662+ } ) ,
665663 }
666664 }
667665 } catch ( error ) {
0 commit comments