summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-03-01 14:34:14 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-03-01 14:34:14 +0800
commit9898f87795b5c3cf096197c6f9c92e368addb2a3 (patch)
tree3c57f328413d6095f57c482759aa89af3e0ee6fe /script/core
parentead187327a6d8d42612856f6e9de153a1994a836 (diff)
downloadlua-language-server-9898f87795b5c3cf096197c6f9c92e368addb2a3.zip
clean up code
Diffstat (limited to 'script/core')
-rw-r--r--script/core/hover/return.lua4
-rw-r--r--script/core/hover/table.lua2
2 files changed, 3 insertions, 3 deletions
diff --git a/script/core/hover/return.lua b/script/core/hover/return.lua
index 3829dbed..0ad39970 100644
--- a/script/core/hover/return.lua
+++ b/script/core/hover/return.lua
@@ -66,12 +66,12 @@ local function asFunction(source)
for _, value in ipairs(values) do
if value.type then
for tp in value.type:gmatch '[^|]+' do
- types[#types+1] = tp
+ types[tp] = true
end
end
end
end
- if #types > 0 or rtn[1] then
+ if next(types) or rtn[1] then
local tp = mergeTypes(types) or 'any'
if rtn[1].name then
line[#line+1] = ('%s%s: %s'):format(
diff --git a/script/core/hover/table.lua b/script/core/hover/table.lua
index 58e64951..f46e722e 100644
--- a/script/core/hover/table.lua
+++ b/script/core/hover/table.lua
@@ -189,7 +189,7 @@ local function mergeTypes(types)
for tp in tv:gmatch '[^|]+' do
if not mark[tp] then
mark[tp] = true
- results[#results+1] = tp
+ results[tp] = true
end
end
end