LuaLS / LuaLS/lua-language-server
Feature Request: Missing Field Diagnostic on Non-Class Table Types
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
(Split from: https://github.com/LuaLS/lua-language-server/issues/2279)
Currently the missing-field diagnostic only works for classes. I sometimes use tables directly instead of classes and it would be nice to still be able to get missing-field warnings:
Ex:
```
---@param audience { [0]: "SELECT", ["peer_ids"]: string | string[] } who to send event to
function Events.send_event(audience, event, ...)
end
Events.send_event({})
```
and
```
---@param audience { [0]: "SELECT", peer_ids: string | string[] } who to send event to
function Events.send_event(audience, event, ...)
end
Events.send_event({})
```
gives no errors
Contributor guide
Research direction
Start by reproducing the two Events.send_event examples from the issue and inspect the existing missing-field diagnostic behavior for classes. Trace how the table parameter types in those examples are analyzed, then verify that calls passing {} report the required fields without changing the existing class behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100