summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/core/diagnostics/unused-local.lua3
-rw-r--r--test/diagnostics/init.lua11
2 files changed, 13 insertions, 1 deletions
diff --git a/script/core/diagnostics/unused-local.lua b/script/core/diagnostics/unused-local.lua
index 072cbd31..7e7bd9d7 100644
--- a/script/core/diagnostics/unused-local.lua
+++ b/script/core/diagnostics/unused-local.lua
@@ -2,6 +2,7 @@ local files = require 'files'
local guide = require 'parser.guide'
local define = require 'proto.define'
local lang = require 'language'
+local vm = require 'vm.vm'
local function hasGet(loc)
if not loc.ref then
@@ -96,7 +97,7 @@ return function (uri, callback)
if isDocClass(source) then
return
end
- if isDocParam(source) then
+ if vm.isMetaFile(uri) and isDocParam(source) then
return
end
local data = hasGet(source)
diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua
index 1bbd83b9..dcbfb962 100644
--- a/test/diagnostics/init.lua
+++ b/test/diagnostics/init.lua
@@ -975,6 +975,14 @@ end
TEST [[
---@param a number
+return function (<!a!>)
+end
+]]
+
+TEST [[
+---@meta
+
+---@param a number
return function (a)
end
]]
@@ -1154,6 +1162,7 @@ TEST [[
local emit = {}
]]
+config.get 'Lua.diagnostics.neededFileStatus' ['unused-local'] = 'None'
TEST [[
---@param table table
---@param metatable table
@@ -1292,6 +1301,8 @@ trim('str', 'left')
trim('str', nil)
]]
+config.get 'Lua.diagnostics.neededFileStatus' ['unused-local'] = 'Any'
+
---不完整的函数参数定义,会跳过检查
TEST [[
---@param mode string