From 6632a278360065a24081a85df23498b9b7bc838b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 26 Apr 2022 12:54:27 +0800 Subject: [PATCH] fix #1093 --- changelog.md | 1 + script/core/diagnostics/unused-function.lua | 5 ++++- test/diagnostics/common.lua | 9 +++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index f2df0b948..080bf34e5 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,7 @@ # changelog ## 3.2.2 +* `FIX` [#1093](https://github.com/sumneko/lua-language-server/issues/1093) * `FIX` runtime errors reported by telemetry, see [#1091](https://github.com/sumneko/lua-language-server/issues/1091) ## 3.2.1 diff --git a/script/core/diagnostics/unused-function.lua b/script/core/diagnostics/unused-function.lua index d3aca1d96..5b1a1f708 100644 --- a/script/core/diagnostics/unused-function.lua +++ b/script/core/diagnostics/unused-function.lua @@ -87,5 +87,8 @@ return function (uri, callback) end -- 只检查局部函数 - guide.eachSourceType(ast.ast, 'function', checkFunction) + ---@async + guide.eachSourceType(ast.ast, 'function', function (src) + checkFunction(src) + end) end diff --git a/test/diagnostics/common.lua b/test/diagnostics/common.lua index 66f85c053..06e95f396 100644 --- a/test/diagnostics/common.lua +++ b/test/diagnostics/common.lua @@ -352,6 +352,15 @@ local ]] + +TEST [[ +local + +local +]] + config.get(nil, 'Lua.diagnostics.disable')['unused-local'] = nil TEST [[ local mt, x