summaryrefslogtreecommitdiff
path: root/script-beta/core/diagnostics
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-20 21:44:57 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-20 21:44:57 +0800
commit4f2e91dad259b6559cec651b10718e1a19352fc3 (patch)
tree581b8bdc73440ded32db5cb0a1a191a02fa64372 /script-beta/core/diagnostics
parent9cd44e1b61fa8f002b211224e0141812a8fc97e6 (diff)
downloadlua-language-server-4f2e91dad259b6559cec651b10718e1a19352fc3.zip
use meta instead of library
Diffstat (limited to 'script-beta/core/diagnostics')
-rw-r--r--script-beta/core/diagnostics/lowercase-global.lua4
-rw-r--r--script-beta/core/diagnostics/redundant-parameter.lua18
-rw-r--r--script-beta/core/diagnostics/undefined-global.lua9
3 files changed, 3 insertions, 28 deletions
diff --git a/script-beta/core/diagnostics/lowercase-global.lua b/script-beta/core/diagnostics/lowercase-global.lua
index d88af685..fe5d1eca 100644
--- a/script-beta/core/diagnostics/lowercase-global.lua
+++ b/script-beta/core/diagnostics/lowercase-global.lua
@@ -2,7 +2,6 @@ local files = require 'files'
local guide = require 'parser.guide'
local lang = require 'language'
local config = require 'config'
-local library = require 'library'
local vm = require 'vm'
local function isDocClass(source)
@@ -28,9 +27,6 @@ return function (uri, callback)
for name in pairs(config.config.diagnostics.globals) do
definedGlobal[name] = true
end
- for name in pairs(library.global) do
- definedGlobal[name] = true
- end
guide.eachSourceType(ast.ast, 'setglobal', function (source)
local name = guide.getName(source)
diff --git a/script-beta/core/diagnostics/redundant-parameter.lua b/script-beta/core/diagnostics/redundant-parameter.lua
index dda6c014..2fae20e8 100644
--- a/script-beta/core/diagnostics/redundant-parameter.lua
+++ b/script-beta/core/diagnostics/redundant-parameter.lua
@@ -5,23 +5,6 @@ local lang = require 'language'
local define = require 'proto.define'
local await = require 'await'
-local function countLibraryArgs(source)
- local lib = vm.getLibrary(source)
- if not lib then
- return nil
- end
- local func = lib.value
- local result = 0
- if not func.args then
- return result
- end
- if func.args[#func.args].type == '...' then
- return math.maxinteger
- end
- result = result + #func.args
- return result
-end
-
local function countCallArgs(source)
local result = 0
if not source.args then
@@ -76,7 +59,6 @@ return function (uri, callback)
end
end
- funcArgs = funcArgs or countLibraryArgs(func)
if not funcArgs then
return
end
diff --git a/script-beta/core/diagnostics/undefined-global.lua b/script-beta/core/diagnostics/undefined-global.lua
index 9ef80182..778fc1f1 100644
--- a/script-beta/core/diagnostics/undefined-global.lua
+++ b/script-beta/core/diagnostics/undefined-global.lua
@@ -1,7 +1,6 @@
local files = require 'files'
local vm = require 'vm'
local lang = require 'language'
-local library = require 'library'
local config = require 'config'
local guide = require 'parser.guide'
@@ -20,15 +19,13 @@ return function (uri, callback)
if config.config.diagnostics.globals[key] then
return
end
- if library.global[key] then
- return
- end
if #vm.getGlobalSets(guide.getKeyName(src)) > 0 then
return
end
local message = lang.script('DIAG_UNDEF_GLOBAL', key)
- local otherVersion = library.other[key]
- local customVersion = library.custom[key]
+ -- TODO check other version
+ local otherVersion
+ local customVersion
if otherVersion then
message = ('%s(%s)'):format(message, lang.script('DIAG_DEFINED_VERSION', table.concat(otherVersion, '/'), config.config.runtime.version))
elseif customVersion then