summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorRoss Williams <ross@ross-williams.net>2023-08-14 10:18:25 -0400
committerRoss Williams <ross@ross-williams.net>2023-08-14 10:18:25 -0400
commit39bb7916ff6a002dc6388fe35a95653a8e23aa16 (patch)
treedb21066b322687e0183ec9b1e9c475ce7c798f5a /script
parentf09aa4104a56996e838dd30d28bbef706e461469 (diff)
downloadlua-language-server-39bb7916ff6a002dc6388fe35a95653a8e23aa16.zip
Ignore cast-local-type diagnostic for `_` local
The `unused-local` diagnostic already hard-codes to exclude `_`. `cast-local-type` should also ignore `_` variables, to avoid warnings in, for example, nested loops like: ```lua for _, list in ipairs(lists) do for _, item in ipairs(list) do _, result = pcall(...) end end ```
Diffstat (limited to 'script')
-rw-r--r--script/core/diagnostics/cast-local-type.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/script/core/diagnostics/cast-local-type.lua b/script/core/diagnostics/cast-local-type.lua
index 1998b915..26445374 100644
--- a/script/core/diagnostics/cast-local-type.lua
+++ b/script/core/diagnostics/cast-local-type.lua
@@ -16,6 +16,9 @@ return function (uri, callback)
if not loc.ref then
return
end
+ if loc[1] == '_' then
+ return
+ end
await.delay()
local locNode = vm.compileNode(loc)
if not locNode.hasDefined then