summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-06-05 15:28:06 +0800
committersumneko <sumneko@hotmail.com>2019-06-05 15:28:06 +0800
commit682f29be361e14af111232288dba87a7003dd959 (patch)
treea4002002884dada56cdc5cca8a447abe18f48567
parentb63b4592368c512c216f18dbb7b1b9a0fae8f771 (diff)
downloadlua-language-server-682f29be361e14af111232288dba87a7003dd959.zip
改一下附加的实现
-rw-r--r--server/debugger.lua13
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)