Skip to content

Commit b1a1b3f

Browse files
committed
only ignore used doced param in meta
1 parent dcfd07a commit b1a1b3f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

script/core/diagnostics/unused-local.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ local files = require 'files'
22
local guide = require 'parser.guide'
33
local define = require 'proto.define'
44
local lang = require 'language'
5+
local vm = require 'vm.vm'
56

67
local function hasGet(loc)
78
if not loc.ref then
@@ -96,7 +97,7 @@ return function (uri, callback)
9697
if isDocClass(source) then
9798
return
9899
end
99-
if isDocParam(source) then
100+
if vm.isMetaFile(uri) and isDocParam(source) then
100101
return
101102
end
102103
local data = hasGet(source)

test/diagnostics/init.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,14 @@ end
974974
]]
975975

976976
TEST [[
977+
---@param a number
978+
return function (<!a!>)
979+
end
980+
]]
981+
982+
TEST [[
983+
---@meta
984+
977985
---@param a number
978986
return function (a)
979987
end
@@ -1154,6 +1162,7 @@ TEST [[
11541162
local emit = {}
11551163
]]
11561164

1165+
config.get 'Lua.diagnostics.neededFileStatus' ['unused-local'] = 'None'
11571166
TEST [[
11581167
---@param table table
11591168
---@param metatable table
@@ -1292,6 +1301,8 @@ trim('str', 'left')
12921301
trim('str', nil)
12931302
]]
12941303

1304+
config.get 'Lua.diagnostics.neededFileStatus' ['unused-local'] = 'Any'
1305+
12951306
---不完整的函数参数定义,会跳过检查
12961307
TEST [[
12971308
---@param mode string

0 commit comments

Comments
 (0)