diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-12-02 21:32:49 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-12-02 21:32:49 +0800 |
commit | 4d3ad397a84f4609f22fda6969c115a2abe5a0dd (patch) | |
tree | 2a25d4826d79b8eda70d202dcb96c55d77ca572e /script | |
parent | 1c87e3a2cdf47c6c98e85ffa82fbfc328654beec (diff) | |
download | lua-language-server-4d3ad397a84f4609f22fda6969c115a2abe5a0dd.zip |
`unused-local` ignored local with `doc.class`
Diffstat (limited to 'script')
-rw-r--r-- | script/core/diagnostics/unused-local.lua | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/script/core/diagnostics/unused-local.lua b/script/core/diagnostics/unused-local.lua index 873a70f2..57730c5f 100644 --- a/script/core/diagnostics/unused-local.lua +++ b/script/core/diagnostics/unused-local.lua @@ -38,7 +38,7 @@ local function isMyTable(loc) return false end -local function isClose(source) +local function isToBeClosed(source) if not source.attrs then return false end @@ -50,6 +50,18 @@ local function isClose(source) return false end +local function isDocClass(source) + if not source.bindDocs then + return false + end + for _, doc in ipairs(source.bindDocs) do + if doc.type == 'doc.class' then + return true + end + end + return false +end + return function (uri, callback) local ast = files.getAst(uri) if not ast then @@ -61,7 +73,10 @@ return function (uri, callback) or name == ast.ENVMode then return end - if isClose(source) then + if isToBeClosed(source) then + return + end + if isDocClass(source) then return end local data = hasGet(source) |