summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-06-16 21:04:34 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-06-16 21:04:34 +0800
commitbe5b3c282faa214bf75f0d719d7a0d809bc09aa1 (patch)
tree01ef7bd7f499bd78d96e740ad74886e42d10f9bf /script/core
parent23eac92eb9e6cb133336f67e104c00b9f200cb5b (diff)
downloadlua-language-server-be5b3c282faa214bf75f0d719d7a0d809bc09aa1.zip
improve
Diffstat (limited to 'script/core')
-rw-r--r--script/core/diagnostics/undefined-doc-name.lua23
1 files changed, 1 insertions, 22 deletions
diff --git a/script/core/diagnostics/undefined-doc-name.lua b/script/core/diagnostics/undefined-doc-name.lua
index c7318fcf..91d4b90e 100644
--- a/script/core/diagnostics/undefined-doc-name.lua
+++ b/script/core/diagnostics/undefined-doc-name.lua
@@ -1,7 +1,6 @@
local files = require 'files'
local guide = require 'parser.guide'
local lang = require 'language'
-local define = require 'proto.define'
local vm = require 'vm'
return function (uri, callback)
@@ -14,26 +13,6 @@ return function (uri, callback)
return
end
- local classCache = {
- ['any'] = true,
- ['nil'] = true,
- }
- local function hasNameOfClassOrAlias(name)
- if classCache[name] ~= nil then
- return classCache[name]
- end
- local docs = vm.getDocDefines(name)
- for _, otherDoc in ipairs(docs) do
- if otherDoc.type == 'doc.class.name'
- or otherDoc.type == 'doc.alias.name' then
- classCache[name] = true
- return true
- end
- end
- classCache[name] = false
- return false
- end
-
local function hasNameOfGeneric(name, source)
if not source.typeGeneric then
return false
@@ -56,7 +35,7 @@ return function (uri, callback)
if name == '...' then
return
end
- if hasNameOfClassOrAlias(name)
+ if vm.isDocDefined(name)
or hasNameOfGeneric(name, source) then
return
end