Originally posted by **Agent-E11** July 2, 2024
I think it would be nice to add some type hints. For instance, for the `battery_status` table:
```lua
---Represents the current status of the battery. Any field can be `nil`, which
---means that the current `method` doesn't support getting that information.
---@class BatteryStatus
---@field percent_charge_remaining integer?
---@field battery_count integer?
---@field ac_power boolean?
---@field method "acpi"|"powersupply"|"powershell"|"pmset"|nil
local battery_status = {
percent_charge_remaining = nil,
battery_count = nil,
ac_power = nil,
method = nil,
}
print(battery_status.test) -- Undefined field `test`.
```
These type hints are provided by [`lua_ls`](https://github.com/LuaLS/lua-language-server), and [here](https://luals.github.io/wiki/annotations/#class) is the documentation.
Discussed in https://github.com/justinhj/battery.nvim/discussions/38