summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-02-02 21:53:48 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-02-02 21:53:48 +0800
commitc1401e4b32a7cf2e9d8e902f562369d255814998 (patch)
tree533b4faba2c9fef8ecafba2e5e0d88d01b2584d3
parent3c07095b860c46b90e7dcc2766589a6279844d6d (diff)
downloadlua-language-server-c1401e4b32a7cf2e9d8e902f562369d255814998.zip
fix #372 hint.paramName forget checking `self`
-rw-r--r--changelog.md3
-rw-r--r--script/core/hint.lua10
2 files changed, 8 insertions, 5 deletions
diff --git a/changelog.md b/changelog.md
index 4cfe117a..ef437a9b 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,8 @@
# changelog
+## 1.14.1
+* `FIX` [#372](https://github.com/sumneko/lua-language-server/issues/372)
+
## 1.14.0
`2021-2-2`
* `NEW` `VSCode` hint
diff --git a/script/core/hint.lua b/script/core/hint.lua
index f592bd77..85aac77d 100644
--- a/script/core/hint.lua
+++ b/script/core/hint.lua
@@ -20,7 +20,8 @@ local function typeHint(uri, edits, start, finish)
if source[1] == '_' then
return
end
- if source.value and guide.isLiteral(source.value) then
+ -- 排除掉 xx = function 与 xx = {}
+ if source.value and (source.value.type == 'function' or source.value.type == 'table') then
return
end
if source.parent.type == 'funcargs' then
@@ -33,10 +34,6 @@ 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
@@ -56,6 +53,9 @@ local function getArgNames(func)
return nil
end
local names = {}
+ if func.parent.type == 'setmethod' then
+ names[#names+1] = 'self'
+ end
for _, arg in ipairs(func.args) do
if arg.type == '...' then
break