summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-09-24 09:53:11 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-09-24 09:53:11 +0800
commite3c493e3cd4954ac3f47e455025cc2922ab10099 (patch)
tree7e80c5562bf8fc33bfe5922dc34c5f7904b68f39
parent88cdad4998bd2c0f644451e755accc8bdfb0f80c (diff)
downloadlua-language-server-e3c493e3cd4954ac3f47e455025cc2922ab10099.zip
整理调试器代码
-rw-r--r--.vscode/launch.json3
-rw-r--r--server-beta/debugger.lua7
-rw-r--r--server-beta/main.lua4
3 files changed, 7 insertions, 7 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json
index dba0ab55..f8762f49 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -19,10 +19,7 @@
"type": "lua",
"request": "attach",
"stopOnEntry": true,
- "sourceCoding": "utf8",
- "consoleCoding": "utf8",
"address": "127.0.0.1:11411",
- "outputCapture": []
},
{
"name": "编译",
diff --git a/server-beta/debugger.lua b/server-beta/debugger.lua
index cc304209..27cd9fe3 100644
--- a/server-beta/debugger.lua
+++ b/server-beta/debugger.lua
@@ -44,9 +44,12 @@ local function tryDebugger()
local addr = "127.0.0.1:" .. port
local dbg = loadfile(entry)('windows', root)
dbg:start(addr)
- --dbg:wait()
log.debug('Debugger startup, listen port:', port)
log.debug('Debugger args:', addr, root, path, cpath)
+ return dbg
end
-xpcall(tryDebugger, log.debug)
+local suc, dbg = xpcall(tryDebugger, log.debug)
+if suc then
+ return dbg
+end
diff --git a/server-beta/main.lua b/server-beta/main.lua
index 83077681..91efcf34 100644
--- a/server-beta/main.lua
+++ b/server-beta/main.lua
@@ -2,7 +2,7 @@ local currentPath = debug.getinfo(1, 'S').source:sub(2)
local rootPath = currentPath:gsub('[/\\]*[^/\\]-$', '')
dofile(rootPath .. '/platform.lua')
local fs = require 'bee.filesystem'
-ROOT = fs.current_path() / rootPath
+ROOT = fs.path(rootPath)
LANG = LANG or 'en-US'
collectgarbage 'generational'
@@ -12,6 +12,6 @@ log.init(ROOT, ROOT / 'log' / 'service.log')
log.info('Lua Lsp startup, root: ', ROOT)
log.debug('ROOT:', ROOT:string())
-xpcall(dofile, log.debug, rootPath .. '/debugger.lua')
+dofile(rootPath .. '/debugger.lua'):wait()
local service = require 'service'
service.start()