summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-06-02 20:44:33 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-06-02 20:44:33 +0800
commit664b740fa40b22180f5055a543c465cb504290cd (patch)
tree27ae8dd233bae87740550e1f0c473486df36d138
parentfd7c1743952cb53a5e849217a202df5b7b82b3b6 (diff)
downloadlua-language-server-664b740fa40b22180f5055a543c465cb504290cd.zip
update
-rw-r--r--meta/template/builtin.lua3
-rw-r--r--meta/template/package.lua6
-rw-r--r--script/core/diagnostics/undefined-global.lua1
-rw-r--r--script/core/infer.lua5
-rw-r--r--script/core/searcher.lua1
5 files changed, 10 insertions, 6 deletions
diff --git a/meta/template/builtin.lua b/meta/template/builtin.lua
index 2b547d1d..45ac24af 100644
--- a/meta/template/builtin.lua
+++ b/meta/template/builtin.lua
@@ -1,6 +1,7 @@
---@meta
----@class any
+---@class unknown
+---@class any: unknown
---@class nil: any
---@class boolean: any
---@class number: any
diff --git a/meta/template/package.lua b/meta/template/package.lua
index ae7def31..8c18e10b 100644
--- a/meta/template/package.lua
+++ b/meta/template/package.lua
@@ -3,13 +3,13 @@
---#if VERSION >=5.4 then
---#DES 'require>5.4'
---@param modname string
----@return any
----@return any loaderdata
+---@return unknown
+---@return unknown loaderdata
function require(modname) end
---#else
---#DES 'require<5.3'
---@param modname string
----@return any
+---@return unknown
function require(modname) end
---#end
diff --git a/script/core/diagnostics/undefined-global.lua b/script/core/diagnostics/undefined-global.lua
index 439a1854..faf5f150 100644
--- a/script/core/diagnostics/undefined-global.lua
+++ b/script/core/diagnostics/undefined-global.lua
@@ -3,7 +3,6 @@ local vm = require 'vm'
local lang = require 'language'
local config = require 'config'
local guide = require 'parser.guide'
-local linker = require 'core.linker'
local requireLike = {
['include'] = true,
diff --git a/script/core/infer.lua b/script/core/infer.lua
index c3e507cc..77236811 100644
--- a/script/core/infer.lua
+++ b/script/core/infer.lua
@@ -216,6 +216,7 @@ end
local function cleanInfers(infers)
local version = config.config.runtime.version
local enableInteger = version == 'Lua 5.3' or version == 'Lua 5.4'
+ infers['unknown'] = nil
if infers['any'] and infers['nil'] then
infers['nil'] = nil
end
@@ -403,7 +404,9 @@ local function searchInfer(source, infers)
local docName = m.getDocName(source)
if docName then
infers[docName] = true
- infers[CLASS] = true
+ if docName ~= 'unknown' then
+ infers[CLASS] = true
+ end
if docName == 'table' then
infers[TABLE] = true
end
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index 121e90c6..2b8eed41 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -9,6 +9,7 @@ local NONE = {'NONE'}
local LAST = {'LAST'}
local ignoredIDs = {
+ ['dn:unknown'] = true,
['dn:nil'] = true,
['dn:any'] = true,
['dn:boolean'] = true,