summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-15 03:56:13 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-15 18:36:33 +0800
commit251f743d8c78b2de2bad2e77657dc35bd6733d67 (patch)
tree50ea94c208f239f58854b63cd2ec314a45b882c7
parent38c34dd6143d551d29bd3177f874bdc7959ab655 (diff)
downloadlua-language-server-251f743d8c78b2de2bad2e77657dc35bd6733d67.zip
add logs
-rw-r--r--.vscode/launch.json2
-rw-r--r--script/provider/provider.lua1
-rw-r--r--script/vm/global-manager.lua10
-rw-r--r--script/vm/local-id.lua5
4 files changed, 16 insertions, 2 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json
index e6811966..59325875 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -26,7 +26,7 @@
"type": "lua",
"request": "attach",
"stopOnEntry": false,
- "address": "127.0.0.1:11413",
+ "address": "127.0.0.1:11429",
"outputCapture": [
],
"sourceMaps": [
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index 35b5147b..f5b21c66 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -998,7 +998,6 @@ m.register '$/didChangeVisibleRanges' {
m.register '$/status/click' {
---@async
function ()
- -- TODO: translate
local titleDiagnostic = lang.script.WINDOW_LUA_STATUS_DIAGNOSIS_TITLE
local result = client.awaitRequestMessage('Info', lang.script.WINDOW_LUA_STATUS_DIAGNOSIS_MSG, {
titleDiagnostic,
diff --git a/script/vm/global-manager.lua b/script/vm/global-manager.lua
index 9752621e..9713856e 100644
--- a/script/vm/global-manager.lua
+++ b/script/vm/global-manager.lua
@@ -240,6 +240,7 @@ function m.getFields(cate, name)
local key = cate .. '|' .. name
-- TODO: optimize
+ local clock = os.clock()
for gid, global in pairs(m.globals) do
if gid ~= key
and util.stringStartWith(gid, key)
@@ -248,6 +249,10 @@ function m.getFields(cate, name)
globals[#globals+1] = global
end
end
+ local cost = os.clock() - clock
+ if cost > 0.1 then
+ log.warn('global-manager getFields cost %.3f', cost)
+ end
return globals
end
@@ -258,12 +263,17 @@ function m.getGlobals(cate)
local globals = {}
-- TODO: optimize
+ local clock = os.clock()
for gid, global in pairs(m.globals) do
if util.stringStartWith(gid, cate)
and not gid:find(m.ID_SPLITE) then
globals[#globals+1] = global
end
end
+ local cost = os.clock() - clock
+ if cost > 0.1 then
+ log.warn('global-manager getGlobals cost %.3f', cost)
+ end
return globals
end
diff --git a/script/vm/local-id.lua b/script/vm/local-id.lua
index cda49d23..aa4f3118 100644
--- a/script/vm/local-id.lua
+++ b/script/vm/local-id.lua
@@ -177,6 +177,7 @@ function m.getFields(source)
return nil
end
-- TODO:optimize
+ local clock = os.clock()
local fields = {}
for lid, sources in pairs(root._localIDs) do
if lid ~= id
@@ -189,6 +190,10 @@ function m.getFields(source)
end
end
end
+ local cost = os.clock() - clock
+ if cost > 1.0 then
+ log.warn('local-id getFields takes %.3f seconds', cost)
+ end
return fields
end