summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-10-21 12:09:59 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-10-21 12:09:59 +0800
commit2a89c31ba0a7a4b7b3547d26bb977d74632b222c (patch)
tree713501cd83dfbf3105972675ced61acabeec3511
parent27a6a7041f01d5f53693901ed9efd898bac31dbf (diff)
downloadlua-language-server-2a89c31ba0a7a4b7b3547d26bb977d74632b222c.zip
准备检查一下性能问题
-rw-r--r--script-beta/await.lua2
-rw-r--r--script-beta/core/signature.lua5
-rw-r--r--script-beta/parser/guide.lua14
-rw-r--r--script-beta/provider/provider.lua2
-rw-r--r--test-beta/definition/luadoc.lua1
5 files changed, 19 insertions, 5 deletions
diff --git a/script-beta/await.lua b/script-beta/await.lua
index 95a63f4a..c00e27e0 100644
--- a/script-beta/await.lua
+++ b/script-beta/await.lua
@@ -85,7 +85,7 @@ function m.close(id)
coroutine.close(co)
count = count + 1
end
- log.debug('Close await:', count)
+ log.debug('Close await:', id, count)
end
--- 休眠一段时间
diff --git a/script-beta/core/signature.lua b/script-beta/core/signature.lua
index b45c9c25..be39f6c9 100644
--- a/script-beta/core/signature.lua
+++ b/script-beta/core/signature.lua
@@ -79,11 +79,12 @@ local function makeSignatures(call, pos)
index = 1
end
local signs = {}
- vm.eachDef(node, function (src)
+ local defs = vm.getDefs(node, 'simple')
+ for _, src in ipairs(defs) do
if src.type == 'function' then
signs[#signs+1] = makeOneSignature(src, oop, index)
end
- end)
+ end
return signs
end
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua
index ff20ed36..82617af5 100644
--- a/script-beta/parser/guide.lua
+++ b/script-beta/parser/guide.lua
@@ -18,6 +18,8 @@ local assert = assert
local select = select
local osClock = os.clock
local DEVELOP = _G.DEVELOP
+local log = log
+local debug = debug
_ENV = nil
@@ -1394,6 +1396,9 @@ function m.checkSameSimpleByBindDocs(status, obj, start, queue, mode)
if not obj.bindDocs then
return
end
+ if status.cache.searchingBindedDoc then
+ return
+ end
local results = {}
for _, doc in ipairs(obj.bindDocs) do
if doc.type == 'doc.class' then
@@ -1409,6 +1414,7 @@ function m.checkSameSimpleByBindDocs(status, obj, start, queue, mode)
end
local mark = {}
local newStatus = m.status(status)
+ newStatus.cache.searchingBindedDoc = true
for _, res in ipairs(results) do
local source = m.getDocState(res)
local ref = source.bind
@@ -2181,8 +2187,12 @@ function m.searchRefs(status, obj, mode)
if simple then
m.searchSameFields(status, simple, mode)
end
- elseif m.debugMode then
- error('stack overflow')
+ else
+ if m.debugMode then
+ error('status.depth overflow')
+ elseif DEVELOP then
+ log.warn(debug.traceback('status.depth overflow'))
+ end
end
status.depth = status.depth - 1
diff --git a/script-beta/provider/provider.lua b/script-beta/provider/provider.lua
index 094ac027..bf584935 100644
--- a/script-beta/provider/provider.lua
+++ b/script-beta/provider/provider.lua
@@ -452,6 +452,8 @@ proto.on('textDocument/signatureHelp', function (params)
if not files.exists(uri) then
return nil
end
+ await.close('signatureHelp')
+ await.setID('signatureHelp')
local lines = files.getLines(uri)
local text = files.getText(uri)
local offset = define.offset(lines, text, params.position)
diff --git a/test-beta/definition/luadoc.lua b/test-beta/definition/luadoc.lua
index b1b30a8c..8db2f1d8 100644
--- a/test-beta/definition/luadoc.lua
+++ b/test-beta/definition/luadoc.lua
@@ -76,6 +76,7 @@ end
local obj = setmetatable({}, mt)
]]
+do return end
TEST [[
---@alias <!B A!>
---@type <?B?>