summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-24 18:26:57 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-24 18:26:57 +0800
commit1ec9c8e266df6db7a72608bfb5431f444e3a12ff (patch)
treec1f9bb92e9a350e1bd335ca38029b84f0e75884c /server/src
parentb7782be38cb8f9d3f94b615976cdfed00e4c183f (diff)
downloadlua-language-server-1ec9c8e266df6db7a72608bfb5431f444e3a12ff.zip
过滤一些结果
Diffstat (limited to 'server/src')
-rw-r--r--server/src/matcher/completion.lua19
-rw-r--r--server/src/workspace.lua8
2 files changed, 15 insertions, 12 deletions
diff --git a/server/src/matcher/completion.lua b/server/src/matcher/completion.lua
index 64ed9428..6debe930 100644
--- a/server/src/matcher/completion.lua
+++ b/server/src/matcher/completion.lua
@@ -231,7 +231,9 @@ local function searchAsArg(vm, inCall, inString, callback)
return
end
for _, v in ipairs(results) do
- callback(v, CompletionItemKind.Module)
+ if v ~= inString[1] then
+ callback(v, CompletionItemKind.Module)
+ end
end
end
end
@@ -344,14 +346,15 @@ return function (vm, pos)
if not result then
return nil
end
- inString = getString(vm, pos)
- if inString then
- local calls = findCall(vm, pos)
- if not calls then
- return nil
- end
- inCall = calls[#calls]
+ end
+
+ inString = getString(vm, pos)
+ if inString then
+ local calls = findCall(vm, pos)
+ if not calls then
+ return nil
end
+ inCall = calls[#calls]
end
local list = {}
diff --git a/server/src/workspace.lua b/server/src/workspace.lua
index 862a163b..f87912e6 100644
--- a/server/src/workspace.lua
+++ b/server/src/workspace.lua
@@ -161,9 +161,9 @@ function mt:convertPathAsRequire(filename, start)
return list
end
-function mt:matchPath(str)
- str = str:lower()
- local first = str:match '[^%.]+'
+function mt:matchPath(input)
+ input = input:lower()
+ local first = input:match '[^%.]+'
if not first then
return nil
end
@@ -175,7 +175,7 @@ function mt:matchPath(str)
local list = self:convertPathAsRequire(filename, start + 1)
if list then
for _, str in ipairs(list) do
- if not results[str] then
+ if not results[str] and #str >= #input then
results[str] = true
results[#results+1] = str
end