diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-12-14 15:47:43 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-12-14 15:47:43 +0800 |
commit | 9a24fa993879985468c291eb9f1003e8b8f5b4ce (patch) | |
tree | 2eea7714d82c2e9cf39790568f3c234fb34c006f /script/core/diagnostics | |
parent | 98bf48a28b34a8437904675d61eeb960a20b8833 (diff) | |
download | lua-language-server-9a24fa993879985468c291eb9f1003e8b8f5b4ce.zip |
`undefined-field` select field only
Diffstat (limited to 'script/core/diagnostics')
-rw-r--r-- | script/core/diagnostics/undefined-field.lua | 18 |
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); |