@@ -45,7 +45,7 @@ export async function convertClientPathToDebugger(localPath: string, namespace:
4545 if ( query . ns && query . ns !== "" ) {
4646 namespace = query . ns . toString ( ) ;
4747 }
48- fileName = pathname . slice ( 1 ) ;
48+ fileName = pathname . slice ( 1 ) . replace ( / \/ / , "." ) ;
4949 } else {
5050 fileName = await vscode . workspace
5151 . openTextDocument ( localPath )
@@ -55,6 +55,8 @@ export async function convertClientPathToDebugger(localPath: string, namespace:
5555 } ) ;
5656 }
5757
58+ namespace = encodeURIComponent ( namespace ) ;
59+ fileName = encodeURIComponent ( fileName ) ;
5860 return `dbgp://|${ namespace } |${ fileName } ` ;
5961}
6062
@@ -204,6 +206,7 @@ export class ObjectScriptDebugSession extends LoggingDebugSession {
204206 await this . _debugTargetSet . wait ( 1000 ) ;
205207
206208 const filePath = args . source . path ;
209+ const uri = filePath . startsWith ( FILESYSTEM_SCHEMA ) ? vscode . Uri . parse ( filePath ) : vscode . Uri . file ( filePath ) ;
207210 const fileUri = await convertClientPathToDebugger ( args . source . path , this . _namespace ) ;
208211 const [ , fileName ] = fileUri . match ( / \| ( [ ^ | ] + ) $ / ) ;
209212
@@ -225,9 +228,9 @@ export class ObjectScriptDebugSession extends LoggingDebugSession {
225228 const line = breakpoint . line ;
226229 if ( breakpoint . condition ) {
227230 return new xdebug . ConditionalBreakpoint ( breakpoint . condition , fileUri , line ) ;
228- } else if ( filePath . endsWith ( "cls" ) ) {
229- return await vscode . workspace . openTextDocument ( filePath ) . then ( document => {
230- const methodMatchPattern = new RegExp ( `^(?:Class)?Method (. +)(?=[( ])` , "i" ) ;
231+ } else if ( fileName . endsWith ( "cls" ) ) {
232+ return await vscode . workspace . openTextDocument ( uri ) . then ( document => {
233+ const methodMatchPattern = new RegExp ( `^(?:Class)?Method ([^(] +)(?=[( ])` , "i" ) ;
231234 for ( let i = line ; line > 0 ; i -- ) {
232235 const lineOfCode = document . lineAt ( i ) . text ;
233236 const methodMatch = lineOfCode . match ( methodMatchPattern ) ;
@@ -286,7 +289,8 @@ export class ObjectScriptDebugSession extends LoggingDebugSession {
286289 stack . stack . map (
287290 async ( stackFrame : xdebug . StackFrame , index ) : Promise < StackFrame > => {
288291 const [ , namespace , name ] = decodeURI ( stackFrame . fileUri ) . match ( / ^ d b g p : \/ \/ \| ( [ ^ | ] + ) \| ( .* ) $ / ) ;
289- const routine = name . includes ( "." ) ? name : name + ".int" ;
292+ const routine = name ;
293+ // const routine = name.includes(".") ? name : name + ".int";
290294 const fileUri = DocumentContentProvider . getUri ( routine , null , namespace ) . toString ( ) ;
291295 const source = new Source ( routine , fileUri ) ;
292296 let line = stackFrame . line + 1 ;
0 commit comments