diff options
-rw-r--r-- | server/src/matcher/signature.lua | 19 | ||||
-rw-r--r-- | server/test/hover/init.lua | 8 | ||||
-rw-r--r-- | server/test/signature/init.lua | 10 |
3 files changed, 12 insertions, 25 deletions
diff --git a/server/src/matcher/signature.lua b/server/src/matcher/signature.lua index 97b8fc00..60316a5f 100644 --- a/server/src/matcher/signature.lua +++ b/server/src/matcher/signature.lua @@ -38,29 +38,16 @@ local function findDirtyCall(vm, pos) return results end -local function parseCall(call) - local results = hover(call.var, call.source, nil, call.select) - return results[1], results[2] -end - return function (vm, pos) local calls = findDirtyCall(vm, pos) if #calls == 0 then return nil end - local results = {} + local hovers = {} for i, call in ipairs(calls) do - local label, description = parseCall(call) - results[i] = { - label = label, - description = description, - arg = { - label = 'a', - description = '参数说明', - } - } + hovers[i] = hover(call.var, call.source, nil, call.select) end - return results + return hovers end diff --git a/server/test/hover/init.lua b/server/test/hover/init.lua index 81057039..5d0cb068 100644 --- a/server/test/hover/init.lua +++ b/server/test/hover/init.lua @@ -13,11 +13,11 @@ function TEST(script) local vm = matcher.vm(ast) assert(vm) local result, source = matcher.findResult(vm, pos) - local results = matcher.hover(result, source) - assert(result) + local hover = matcher.hover(result, source) + assert(hover) expect = expect:gsub('^[\r\n]*(.-)[\r\n]*$', '%1'):gsub('\r\n', '\n') - local result = results[1]:gsub('^[\r\n]*(.-)[\r\n]*$', '%1'):gsub('\r\n', '\n') - assert(expect == result) + local label = hover.label:gsub('^[\r\n]*(.-)[\r\n]*$', '%1'):gsub('\r\n', '\n') + assert(expect == label) end end diff --git a/server/test/signature/init.lua b/server/test/signature/init.lua index 620aab4b..855ffa24 100644 --- a/server/test/signature/init.lua +++ b/server/test/signature/init.lua @@ -10,13 +10,13 @@ function TEST(script) local ast = parser:ast(new_script) local vm = matcher.vm(ast) assert(vm) - local results = matcher.signature(vm, pos) - assert(results) - local result = results[#results] + local hovers = matcher.signature(vm, pos) + assert(hovers) + local hover = hovers[#hovers] - local label = result.label:gsub('^[\r\n]*(.-)[\r\n]*$', '%1'):gsub('\r\n', '\n') + local label = hover.label:gsub('^[\r\n]*(.-)[\r\n]*$', '%1'):gsub('\r\n', '\n') expect.label = expect.label:gsub('^[\r\n]*(.-)[\r\n]*$', '%1'):gsub('\r\n', '\n') - local arg = result.arg.label + local arg = hover.argLabel assert(expect.label == label) assert(expect.arg == arg) |