From cb53aa2a6f274dba37b781be2597f8da8f02e0bd Mon Sep 17 00:00:00 2001 From: spacehamster Date: Fri, 6 Nov 2020 10:48:41 +1100 Subject: [PATCH 1/2] Add config option to resolve filepath of lua chunks loaded with loadbuffer instead of loadfile. --- debuggee/vscode-debuggee.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/debuggee/vscode-debuggee.lua b/debuggee/vscode-debuggee.lua index 61b47fb..d322f02 100644 --- a/debuggee/vscode-debuggee.lua +++ b/debuggee/vscode-debuggee.lua @@ -18,6 +18,7 @@ local redirectedPrintFunction = nil local onError = nil local addUserdataVar = nil +local resolveChunkPath = nil local function defaultOnError(e) print('****************************************************') @@ -493,6 +494,7 @@ function debuggee.start(jsonLib, config) local redirectPrint = config.redirectPrint or false dumpCommunication = config.dumpCommunication or false ignoreFirstFrameInC = config.ignoreFirstFrameInC or false + resolveChunkPath = config.resolveChunkPath or function(name) return name end if not config.luaStyleLog then valueToString = function(value) return json.encode(value) end end @@ -791,6 +793,8 @@ function handlers.stackTrace(req) local src = info.source if string.sub(src, 1, 1) == '@' then src = string.sub(src, 2) -- 앞의 '@' 떼어내기 + else + src = resolveChunkPath(src) end local name From ba965040e607e74b90ba0e2831ba3dc85caa3fa7 Mon Sep 17 00:00:00 2001 From: spacehamster Date: Sun, 8 Nov 2020 19:33:04 +1100 Subject: [PATCH 2/2] Resolve chunk names loaded as strings for pure breaker breakpoints --- debuggee/vscode-debuggee.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/debuggee/vscode-debuggee.lua b/debuggee/vscode-debuggee.lua index d322f02..d5ad228 100644 --- a/debuggee/vscode-debuggee.lua +++ b/debuggee/vscode-debuggee.lua @@ -335,7 +335,9 @@ local function createPureBreaker() if cached then return cached end - + if string.sub(chunkname, 1, 1) ~= '@' then + chunkname = resolveChunkPath(chunkname) + end local splitedReqPath = splitChunkName(chunkname) local maxMatchCount = 0 local foundPath = nil