Skip to content

Commit 82b12ab

Browse files
committed
Fix cspell error and add mod type examples
1 parent 269418c commit 82b12ab

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ If you prefer to not use EmmyLua, the following configuration works well for Sum
258258
}
259259
```
260260

261-
The extension will automatically skip large files from being preloaded (controlled by `Lua.workspace.preloadFileSize`), so they don't have to be excluded. The configuration file can be found by pressing Ctrl-Shift-P and selecting `Preferences: Open Workspace Settings (JSON)`. If you wish to check test files, you can remove the "ignoredFiles" option and install the busted, luafilesystem, and luassert LuaLS addons through `Lua: Open Addon Manager`.
261+
The extension will automatically skip large files from being preloaded (controlled by `Lua.workspace.preloadFileSize`), so they don't have to be excluded. The configuration file can be found by pressing Ctrl-Shift-P and selecting `Preferences: Open Workspace Settings (JSON)`. If you wish to check test files, you can remove the "ignoredFiles" option and install the busted, LuaFileSystem, and luassert LuaLS addons through `Lua: Open Addon Manager`.
262262

263263
### PyCharm Community / IntelliJ Idea Community
264264

src/Modules/ModParser.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,6 +2043,7 @@ local explodeFunc = function(chance, amount, type, ...)
20432043
end
20442044

20452045
-- List of special modifiers
2046+
---@type table<string, Mod[]|fun(num: number, ...: string): Mod|Mod[]>
20462047
local specialModList = {
20472048
-- Explode mods
20482049
["enemies you kill have a (%d+)%% chance to explode, dealing a (.+) of their maximum life as (.+) damage"] = function(chance, _, amount, type) -- Obliteration, Unspeakable Gifts (chaos cluster), synth implicit mod, current crusader body mod, Ngamahu Warmonger tattoo
@@ -6402,6 +6403,11 @@ end
64026403

64036404
-- Scan a line for the earliest and longest match from the pattern list
64046405
-- If a match is found, returns the corresponding value from the pattern list, plus the remainder of the line and a table of captures
6406+
---@generic T
6407+
---@param line string
6408+
---@param patternList table<string, T>
6409+
---@param plain? boolean
6410+
---@return T?, string, string[]?
64056411
local function scan(line, patternList, plain)
64066412
local bestIndex, bestEndIndex
64076413
local bestPattern = ""
@@ -6545,6 +6551,7 @@ local function parseMod(line, order)
65456551
modFlag, line = scan(line, modFlagList, true)
65466552

65476553
-- Find modifier value and type according to form
6554+
---@type string|number|table
65486555
local modValue = tonumber(formCap[1]) or formCap[1]
65496556
local modType = "BASE"
65506557
local modSuffix

src/Modules/ModTools.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ local bor = bit.bor
1717

1818
modLib = { }
1919

20+
--- "Flag" is only used with CanNotUseItem
21+
---@alias Doubled ["MORE", "OVERRIDE"]
22+
---@alias NumericModTypes "INC"|"MORE"|"BASE"|"OVERRIDE"|"MAX"|"CHANCE"|"DUMMY"|"Flag"|"MIN"|Doubled
23+
24+
---@overload fun(modName: string, modType: NumericModTypes, modVal?: number)
25+
---@overload fun(modName: string, modType: "FLAG", modVal: boolean)
26+
---@overload fun(modName: string, modType: "LIST", modVal: any[]|any)
27+
---@return Mod
2028
function modLib.createMod(modName, modType, modVal, ...)
2129
local flags = 0
2230
local keywordFlags = 0
@@ -34,6 +42,7 @@ function modLib.createMod(modName, modType, modVal, ...)
3442
keywordFlags = select(3, ...)
3543
tagStart = 4
3644
end
45+
---@class Mod
3746
return {
3847
name = modName,
3948
type = modType,

0 commit comments

Comments
 (0)