diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-19 16:40:08 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-19 16:40:08 +0800 |
commit | 46548fdb0083af9aad1cd42986682e7f969890ce (patch) | |
tree | ba3d2a203012429789127c117f9bc788ea3fa9aa /server/src | |
parent | cdd20c7926fe37ea627741eae34d70e24b111ff4 (diff) | |
download | lua-language-server-46548fdb0083af9aad1cd42986682e7f969890ce.zip |
面向对象调用时只显示方法
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/matcher/completion.lua | 11 | ||||
-rw-r--r-- | server/src/matcher/diagnostics.lua | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/server/src/matcher/completion.lua b/server/src/matcher/completion.lua index d280cb53..0f0b0ced 100644 --- a/server/src/matcher/completion.lua +++ b/server/src/matcher/completion.lua @@ -114,7 +114,7 @@ local function searchLocals(vm, pos, name, callback) end end -local function searchFields(name, parent, callback) +local function searchFields(name, parent, object, callback) if not parent or not parent.value or not parent.value.child then return end @@ -122,6 +122,11 @@ local function searchFields(name, parent, callback) if type(key) ~= 'string' then goto CONTINUE end + if object then + if not field.value or field.value.type ~= 'function' then + goto CONTINUE + end + end if matchKey(name, key) then callback(field) end @@ -198,7 +203,7 @@ local function searchAsGlobal(vm, pos, result, callback) searchLocals(vm, pos, result.key, function (var) callback(var, CompletionItemKind.Variable) end) - searchFields(result.key, vm.results.locals[1], function (var) + searchFields(result.key, vm.results.locals[1], nil, function (var) callback(var, CompletionItemKind.Field) end) searchKeyWords(result.key, function (name) @@ -207,7 +212,7 @@ local function searchAsGlobal(vm, pos, result, callback) end local function searchAsSuffix(result, callback) - searchFields(result.key, result.parent, function (var) + searchFields(result.key, result.parent, result.source.object, function (var) callback(var, CompletionItemKind.Field) end) end diff --git a/server/src/matcher/diagnostics.lua b/server/src/matcher/diagnostics.lua index f22ce7cb..3593acd9 100644 --- a/server/src/matcher/diagnostics.lua +++ b/server/src/matcher/diagnostics.lua @@ -224,7 +224,7 @@ return function (vm, lines, uri) start = start, finish = finish, level = 'Warning', - message = ('The function takes only %d parameters, but you pass %d.'):format(max, passed), -- LOCALE + message = ('The function takes only %d parameters, but you passed %d.'):format(max, passed), -- LOCALE } end) return datas |