summaryrefslogtreecommitdiff
path: root/script/core/diagnostics
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-12-14 15:47:43 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-12-14 15:47:43 +0800
commit9a24fa993879985468c291eb9f1003e8b8f5b4ce (patch)
tree2eea7714d82c2e9cf39790568f3c234fb34c006f /script/core/diagnostics
parent98bf48a28b34a8437904675d61eeb960a20b8833 (diff)
downloadlua-language-server-9a24fa993879985468c291eb9f1003e8b8f5b4ce.zip
`undefined-field` select field only
Diffstat (limited to 'script/core/diagnostics')
-rw-r--r--script/core/diagnostics/undefined-field.lua18
1 files changed, 13 insertions, 5 deletions
diff --git a/script/core/diagnostics/undefined-field.lua b/script/core/diagnostics/undefined-field.lua
index 67208e35..04ae95dd 100644
--- a/script/core/diagnostics/undefined-field.lua
+++ b/script/core/diagnostics/undefined-field.lua
@@ -94,11 +94,19 @@ return function (uri, callback)
if not fields[fieldName] then
local message = lang.script('DIAG_UNDEF_FIELD', fieldName)
- callback {
- start = src.start,
- finish = src.finish,
- message = message,
- }
+ if src.type == 'getfield' then
+ callback {
+ start = src.field.start,
+ finish = src.field.finish,
+ message = message,
+ }
+ elseif src.type == 'getmethod' then
+ callback {
+ start = src.method.start,
+ finish = src.method.finish,
+ message = message,
+ }
+ end
end
end
guide.eachSourceType(ast.ast, 'getfield', checkUndefinedField);