-
Notifications
You must be signed in to change notification settings - Fork 165
Open
Description
#240 added the EmmyLua spoon to generate EmmyLua annotations for hs modules. I am not sure if the logic used to generate annotations has gone out of date or there was always an issue, but I've noticed that many of the annotations for hs.fnutils are missing or incorrect. For example, here is the annotation for hs.fnutils.map:
-- Execute a function across a table (in arbitrary order) and collect the results
--
-- Parameters:
-- * table - A table; it can have both a list (or array) part and a hash (or dict) part
-- * fn - A function that accepts a single parameter (a table element). For the hash part, the values returned
-- from this function (if non-nil) will be assigned to the same key in the result list. For the array part, this function
-- behaves like `hs.fnutils.imap()` (i.e. `nil` results are discarded); however all keys, including integer keys after
-- a "hole" in `table`, will be iterated over.
--
-- Returns:
-- * A table containing the results of calling the function on every element in the table
--
-- Notes:
-- * If `table` is a pure array table (list-like) without "holes", use `hs.fnutils.imap()` if you need guaranteed in-order
-- processing and for better performance.
function M.map(table, fn, ...) end
This is interpreted by current versions of lua_language_server as a nil return value. You end up with tons of false positive diagnostics wherever hs.fnutils is used.
It is possible there is a similar issue with other hs.* modules, I haven't checked.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels