[Lua] Suppress some diagnostics and also recommend suppressing certain diagnostics globally

This commit is contained in:
Celtic Minstrel 2024-02-04 14:40:32 -05:00 committed by Celtic Minstrel
parent 7891a9f06f
commit 542581916f
3 changed files with 5 additions and 1 deletions

View File

@ -274,6 +274,7 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
---@type location
local loc, n = wesnoth.map.read_location(x, y)
if n == 0 then error('Missing or invalid coordinate') end
---@diagnostic disable-next-line: return-type-mismatch
return setmetatable({x = loc.x, y = loc.y}, hex_mt)
end
@ -282,7 +283,7 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
---@param cfg WML
---@param ref_unit? unit
---@return terrain_hex[]
function wesnoth.map.find(cfg, ref_unit)
function wesnoth.map.find(cfg, ref_unit) ---@diagnostic disable-line: duplicate-set-field
local hexes = find_locations(cfg, ref_unit)
for i = 1, #hexes do
hexes[i] = wesnoth.map.get(hexes[i][1], hexes[i][2])

View File

@ -1,4 +1,5 @@
--[========[Config Manipulation Functions]========]
---@diagnostic disable: deprecated
print("Loading WML module...")
local function ensure_config(cfg)

View File

@ -6,6 +6,8 @@ To enable in Visual Studio Code, install [this Lua plugin](https://marketplace.v
```json
"Lua.runtime.version": "Lua 5.4",
"Lua.type.weakNilCheck": true,
"Lua.type.weakUnionCheck": true,
"Lua.workspace.library": [
"./utils/emmylua"
],