summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-16 00:54:04 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-16 00:54:04 +0800
commit14d2231564b95d4261e6db8593bfb8058d22c4ab (patch)
tree0fd8b77915e7007b863cc724df1fd51f926c59ea
parentcde9a29b812b805023853e913c3b3ddb8de89721 (diff)
downloadlua-language-server-14d2231564b95d4261e6db8593bfb8058d22c4ab.zip
fix runtime error
-rw-r--r--script/core/diagnostics/undefined-doc-class.lua34
1 files changed, 18 insertions, 16 deletions
diff --git a/script/core/diagnostics/undefined-doc-class.lua b/script/core/diagnostics/undefined-doc-class.lua
index 8f1aa097..fb57f427 100644
--- a/script/core/diagnostics/undefined-doc-class.lua
+++ b/script/core/diagnostics/undefined-doc-class.lua
@@ -20,24 +20,26 @@ return function (uri, callback)
goto CONTINUE
end
for _, ext in ipairs(doc.extends) do
- local name = ext[1]
- local docs = vm.getDocSets(uri, name)
- if cache[name] == nil then
- cache[name] = false
- for _, otherDoc in ipairs(docs) do
- if otherDoc.type == 'doc.class' then
- cache[name] = true
- break
+ local name = ext.type == 'doc.extends.name' and ext[1]
+ if name then
+ local docs = vm.getDocSets(uri, name)
+ if cache[name] == nil then
+ cache[name] = false
+ for _, otherDoc in ipairs(docs) do
+ if otherDoc.type == 'doc.class' then
+ cache[name] = true
+ break
+ end
end
end
- end
- if not cache[name] then
- callback {
- start = ext.start,
- finish = ext.finish,
- related = cache,
- message = lang.script('DIAG_UNDEFINED_DOC_CLASS', name)
- }
+ if not cache[name] then
+ callback {
+ start = ext.start,
+ finish = ext.finish,
+ related = cache,
+ message = lang.script('DIAG_UNDEFINED_DOC_CLASS', name)
+ }
+ end
end
end
end