summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-02-02 21:56:55 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-02-02 21:56:55 +0800
commitc33747ecdb348a77294e717a88a8b75d0a06ba33 (patch)
tree8aac85666a952fd829c5e098625fb13b1030bd2f /script/core
parentc1401e4b32a7cf2e9d8e902f562369d255814998 (diff)
downloadlua-language-server-c33747ecdb348a77294e717a88a8b75d0a06ba33.zip
#372 wrong submission
Diffstat (limited to 'script/core')
-rw-r--r--script/core/hint.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/script/core/hint.lua b/script/core/hint.lua
index 85aac77d..df191b9c 100644
--- a/script/core/hint.lua
+++ b/script/core/hint.lua
@@ -20,8 +20,7 @@ local function typeHint(uri, edits, start, finish)
if source[1] == '_' then
return
end
- -- 排除掉 xx = function 与 xx = {}
- if source.value and (source.value.type == 'function' or source.value.type == 'table') then
+ if source.value and guide.isLiteral(source.value) then
return
end
if source.parent.type == 'funcargs' then
@@ -34,6 +33,10 @@ local function typeHint(uri, edits, start, finish)
end
end
local infer = vm.getInferType(source, 0)
+ if infer == 'any'
+ or infer == 'nil' then
+ return
+ end
local src = source
if source.type == 'tablefield' then
src = source.field