summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-21 17:26:36 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-21 17:26:36 +0800
commit1376bba0f9cfc3e8f06130c3bb4f86589b0dc32a (patch)
treebfd4d68473187c8777a889c88ce5f90b478aa93c /server
parent5ddbf413f3484843d143a7e4a9c228a847c95eef (diff)
downloadlua-language-server-1376bba0f9cfc3e8f06130c3bb4f86589b0dc32a.zip
不可以在字符串内部
Diffstat (limited to 'server')
-rw-r--r--server/src/matcher/signature.lua17
1 files changed, 10 insertions, 7 deletions
diff --git a/server/src/matcher/signature.lua b/server/src/matcher/signature.lua
index 7b51d5e6..96694047 100644
--- a/server/src/matcher/signature.lua
+++ b/server/src/matcher/signature.lua
@@ -10,18 +10,21 @@ end
local function findArgCount(args, pos)
for i, arg in ipairs(args) do
if isContainPos(arg, pos) then
- return i
+ return i, arg
end
end
- return #args + 1
+ return #args + 1, nil
end
--- 找出范围包含pos的,且有dirty标记的call
-local function findDirtyCall(vm, pos)
+-- 找出范围包含pos的call
+local function findCall(vm, pos)
local results = {}
for _, call in ipairs(vm.results.calls) do
if isContainPos(call.args, pos) then
- local n = findArgCount(call.args, pos)
+ local n, arg = findArgCount(call.args, pos)
+ if arg and arg.type == 'string' then
+ return nil
+ end
results[#results+1] = {
func = call.func,
var = vm.results.sources[call.lastObj],
@@ -39,8 +42,8 @@ local function findDirtyCall(vm, pos)
end
return function (vm, pos)
- local calls = findDirtyCall(vm, pos)
- if #calls == 0 then
+ local calls = findCall(vm, pos)
+ if not calls or #calls == 0 then
return nil
end