diff options
author | sumneko <sumneko@hotmail.com> | 2019-06-05 15:28:06 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-06-05 15:28:06 +0800 |
commit | 682f29be361e14af111232288dba87a7003dd959 (patch) | |
tree | a4002002884dada56cdc5cca8a447abe18f48567 | |
parent | b63b4592368c512c216f18dbb7b1b9a0fae8f771 (diff) | |
download | lua-language-server-682f29be361e14af111232288dba87a7003dd959.zip |
改一下附加的实现
-rw-r--r-- | server/debugger.lua | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/server/debugger.lua b/server/debugger.lua index 76266313..c2e262b7 100644 --- a/server/debugger.lua +++ b/server/debugger.lua @@ -37,19 +37,18 @@ local debugPath = extensionPath / luaDebugs[1] local cpath = "/runtime/win64/lua54/?.dll" local path = "/script/?.lua" -package.cpath = package.cpath .. ';' .. debugPath:string() .. cpath - local function tryDebugger() - local rdebug = require "remotedebug" + local remote = package.searchpath('remotedebug', debugPath:string() .. cpath) local entry = package.searchpath('start_debug', debugPath:string() .. path) + local rdebug = package.loadlib(remote,'luaopen_remotedebug')() local root = debugPath:string() - local pid = "11411" - local addr = ("@%s/runtime/tmp/pid_%s.tmp"):format(root, pid) + local port = '11411' + local addr = "127.0.0.1:" .. port local dbg = loadfile(entry)(rdebug, root, path, cpath) debug.getregistry()["lua-debug"] = dbg dbg:start(addr, true) - log.debug('Debugger startup, listen port:', pid) - log.debug('Args:', addr, rdebug, root, path, cpath) + log.debug('Debugger startup, listen port:', port) + log.debug('Debugger args:', addr, root, path, cpath) end xpcall(tryDebugger, log.debug) |