diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-11-05 20:34:17 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-11-05 20:34:17 +0800 |
commit | 12eecd0df7d2c577d56b5e81e393963a614dc8e7 (patch) | |
tree | 2a6d85959cf9fbe4d7feee44c552f0f868d8743d /server-beta/src/core/diagnostics/redundant-parameter.lua | |
parent | c844e46ae97f28ec928db6b701fdf5f2eea2664d (diff) | |
download | lua-language-server-12eecd0df7d2c577d56b5e81e393963a614dc8e7.zip |
更新诊断
Diffstat (limited to 'server-beta/src/core/diagnostics/redundant-parameter.lua')
-rw-r--r-- | server-beta/src/core/diagnostics/redundant-parameter.lua | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/server-beta/src/core/diagnostics/redundant-parameter.lua b/server-beta/src/core/diagnostics/redundant-parameter.lua index c087197c..79c259d8 100644 --- a/server-beta/src/core/diagnostics/redundant-parameter.lua +++ b/server-beta/src/core/diagnostics/redundant-parameter.lua @@ -3,12 +3,28 @@ local guide = require 'parser.guide' local searcher = require 'searcher' local lang = require 'language' local define = require 'proto.define' +local library = require 'library' -local function packCallArgs(source) - if not source.args then +local function packLibraryArgs(source) + local func = searcher.getLibrary(source) + if not func then return nil end local result = {} + if not func.args then + return result + end + for _, lib in ipairs(func.args) do + result[#result+1] = lib + end + return result +end + +local function packCallArgs(source) + local result = {} + if not source.args then + return result + end if source.node and source.node.type == 'getmethod' then result[#result+1] = source.node.node end @@ -19,10 +35,10 @@ local function packCallArgs(source) end local function packFuncArgs(source) + local result = {} if not source.args then - return nil + return result end - local result = {} if source.parent and source.parent.type == 'setmethod' then result[#result+1] = source.parent.node end @@ -58,6 +74,7 @@ return function (uri, callback) end end) + funcArgs = funcArgs or packLibraryArgs(func) if not funcArgs then return end |