summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md3
-rw-r--r--script/core/completion.lua1
-rw-r--r--test/completion/init.lua59
3 files changed, 42 insertions, 21 deletions
diff --git a/changelog.md b/changelog.md
index 1e95e1a8..3cb26321 100644
--- a/changelog.md
+++ b/changelog.md
@@ -3,7 +3,8 @@
## 2.1.0
* `NEW` supports local config file, using `--configpath="config.json"`, [learn more here](https://github.com/sumneko/lua-language-server/wiki/Setting-without-VSCode)
* `NEW` goto `type definition`
-* `FIX` completion: sometimes `type() ==` does not work
+* `CHG` [#549](https://github.com/sumneko/lua-language-server/issues/549)
+* `FIX` completion: `type() ==` may does not work
## 2.0.5
`2021-7-1`
diff --git a/script/core/completion.lua b/script/core/completion.lua
index 83a08a83..860126b9 100644
--- a/script/core/completion.lua
+++ b/script/core/completion.lua
@@ -500,7 +500,6 @@ local function checkFieldOfRefs(refs, ast, word, start, offset, parent, oop, res
or value.type == 'doc.type.function' then
funcLabel = name .. getParams(value, oop)
fields[funcLabel] = src
- fields[name] = false
count = count + 1
if value.type == 'function' and value.bindDocs then
for _, doc in ipairs(value.bindDocs) do
diff --git a/test/completion/init.lua b/test/completion/init.lua
index d55d1c9a..0f96949d 100644
--- a/test/completion/init.lua
+++ b/test/completion/init.lua
@@ -2548,22 +2548,43 @@ end
]]
(EXISTS)
---config.set('Lua.completion.callSnippet', 'Disable')
---
---TEST [[
---GGG = 1
---GGG = function ()
---end
---
---GGG$
---]]
---{
--- {
--- label = 'GGG = 1',
--- kind = define.CompletionItemKind.Variable,
--- },
--- {
--- label = 'GGG()',
--- kind = define.CompletionItemKind.Function,
--- },
---}
+config.set('Lua.completion.callSnippet', 'Disable')
+
+TEST [[
+GGG = 1
+GGG = function ()
+end
+
+GGG$
+]]
+{
+ {
+ label = 'GGG',
+ kind = define.CompletionItemKind.Enum,
+ },
+ {
+ label = 'GGG()',
+ kind = define.CompletionItemKind.Function,
+ },
+}
+
+TEST [[
+---@class C
+---@field GGG number
+local t = {}
+
+t.GGG = function ()
+end
+
+t.GGG$
+]]
+{
+ {
+ label = 't.GGG',
+ kind = define.CompletionItemKind.Enum,
+ },
+ {
+ label = 't.GGG()',
+ kind = define.CompletionItemKind.Function,
+ },
+}