@@ -378,6 +378,28 @@ export class LuaDebugSession extends LoggingDebugSession {
378
378
this . sendResponse ( response ) ;
379
379
}
380
380
381
+ protected async sourceRequest (
382
+ response : DebugProtocol . SourceResponse ,
383
+ args : DebugProtocol . SourceArguments ,
384
+ ) : Promise < void > {
385
+ if ( args . source ?. adapterData === "tarantool-builtin-data" ) {
386
+ const msg = await this . waitForCommandResponse ( `tarantool-builtin-data ${ args . source . path ?? "" } ` ) ;
387
+ if ( msg . type === "result" ) {
388
+ const result = msg . results [ 0 ] ;
389
+ if ( result . type === "string" ) {
390
+ let content = result . value ?? "" ;
391
+
392
+ content = content . replace ( / ^ " / , "" ) ;
393
+ content = content . replace ( / " $ / , "" ) ;
394
+
395
+ response . body = { content} ;
396
+ }
397
+ }
398
+ }
399
+
400
+ this . sendResponse ( response ) ;
401
+ }
402
+
381
403
protected async stackTraceRequest (
382
404
response : DebugProtocol . StackTraceResponse ,
383
405
args : DebugProtocol . StackTraceArguments
@@ -414,7 +436,17 @@ export class LuaDebugSession extends LoggingDebugSession {
414
436
//Un-mapped source
415
437
const sourcePath = this . resolvePath ( frame . source ) ;
416
438
if ( typeof source === "undefined" && typeof sourcePath !== "undefined" ) {
417
- source = new Source ( path . basename ( frame . source ) , sourcePath ) ;
439
+ if ( sourcePath . indexOf ( "builtin/" ) === 0 ) {
440
+ source = new Source (
441
+ path . basename ( frame . source ) ,
442
+ this . convertDebuggerPathToClient ( sourcePath ) ,
443
+ 1 ,
444
+ "internal module" ,
445
+ "tarantool-builtin-data"
446
+ ) ;
447
+ } else {
448
+ source = new Source ( path . basename ( frame . source ) , sourcePath ) ;
449
+ }
418
450
}
419
451
420
452
//Function name
@@ -763,6 +795,10 @@ export class LuaDebugSession extends LoggingDebugSession {
763
795
return ;
764
796
}
765
797
798
+ if ( filePath . indexOf ( "builtin/" ) === 0 ) {
799
+ return filePath ;
800
+ }
801
+
766
802
const config = this . assert ( this . config ) ;
767
803
let fullPath = path . isAbsolute ( filePath ) ? filePath : path . join ( config . cwd , filePath ) ;
768
804
0 commit comments