summaryrefslogtreecommitdiff
path: root/script/core/diagnostics/unused-local.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-02-18 11:14:47 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-02-18 11:14:47 +0800
commit5163ff8323411bc6a90504c66871cea60eeeb994 (patch)
tree747ff0c5523c4c85b99803ba190d1fbaef688166 /script/core/diagnostics/unused-local.lua
parentaca8eb8bcfacdc534f02e21b8b391d936b371114 (diff)
downloadlua-language-server-5163ff8323411bc6a90504c66871cea60eeeb994.zip
`unused-local` excludes `doc.param`
Diffstat (limited to 'script/core/diagnostics/unused-local.lua')
-rw-r--r--script/core/diagnostics/unused-local.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/script/core/diagnostics/unused-local.lua b/script/core/diagnostics/unused-local.lua
index 57730c5f..9bb2c492 100644
--- a/script/core/diagnostics/unused-local.lua
+++ b/script/core/diagnostics/unused-local.lua
@@ -62,6 +62,20 @@ local function isDocClass(source)
return false
end
+local function isDocParam(source)
+ if not source.bindDocs then
+ return false
+ end
+ for _, doc in ipairs(source.bindDocs) do
+ if doc.type == 'doc.param' then
+ if doc.param[1] == source[1] then
+ return true
+ end
+ end
+ end
+ return false
+end
+
return function (uri, callback)
local ast = files.getAst(uri)
if not ast then
@@ -79,6 +93,9 @@ return function (uri, callback)
if isDocClass(source) then
return
end
+ if isDocParam(source) then
+ return
+ end
local data = hasGet(source)
if data == 'strong' then
return