summaryrefslogtreecommitdiff
path: root/script/core/diagnostics
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-08 17:26:18 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-08 17:26:18 +0800
commit7c29a6012bf5fe2cc1ff79598f8be6f80528e767 (patch)
tree6afee29f52c8862bfe7d6e780022bfb6d4ecabd5 /script/core/diagnostics
parent4c71c56f925246618cce854ab9773311a7812055 (diff)
downloadlua-language-server-7c29a6012bf5fe2cc1ff79598f8be6f80528e767.zip
cleanup
Diffstat (limited to 'script/core/diagnostics')
-rw-r--r--script/core/diagnostics/undefined-doc-param.lua42
1 files changed, 7 insertions, 35 deletions
diff --git a/script/core/diagnostics/undefined-doc-param.lua b/script/core/diagnostics/undefined-doc-param.lua
index 98919284..7a60a74f 100644
--- a/script/core/diagnostics/undefined-doc-param.lua
+++ b/script/core/diagnostics/undefined-doc-param.lua
@@ -1,21 +1,6 @@
local files = require 'files'
local lang = require 'language'
-local function hasParamName(func, name)
- if not func.args then
- return false
- end
- for _, arg in ipairs(func.args) do
- if arg[1] == name then
- return true
- end
- if arg.type == '...' and name == '...' then
- return true
- end
- end
- return false
-end
-
return function (uri, callback)
local state = files.getState(uri)
if not state then
@@ -27,26 +12,13 @@ return function (uri, callback)
end
for _, doc in ipairs(state.ast.docs) do
- if doc.type ~= 'doc.param' then
- goto CONTINUE
- end
- local binds = doc.bindSources
- if not binds then
- goto CONTINUE
- end
- local param = doc.param
- local name = param[1]
- for _, source in ipairs(binds) do
- if source.type == 'function' then
- if not hasParamName(source, name) then
- callback {
- start = param.start,
- finish = param.finish,
- message = lang.script('DIAG_UNDEFINED_DOC_PARAM', name)
- }
- end
- end
+ if doc.type == 'doc.param'
+ and not doc.bindSource then
+ callback {
+ start = doc.param.start,
+ finish = doc.param.finish,
+ message = lang.script('DIAG_UNDEFINED_DOC_PARAM', doc.param[1])
+ }
end
- ::CONTINUE::
end
end