Skip to content

Conversation

dbluhm
Copy link

@dbluhm dbluhm commented May 17, 2025

When using plenary.job with LuaLS running, using Job:new resulted in an error saying that there were missing required fields:
image

These fields are the defined methods on Job. Since Job:new was annotated as accepting as param o a value of type Job, LuaLS is expecting o to have all of the fields of Job. This obviously isn't how Job:new is intended to be used.

This PR adds a separate type definition for a JobOptions, containing all of the field annotations originally on Job. It also makes the Job class definition inherit these fields. It then makes Job:new accept a JobOptions instead of Job for param o. This also adds string[] as an acceptable type for o to support that usage pattern.

There is one other unrelated change (happy to drop if it's not agreeable): setting uv to vim.uv or vim.loop, since vim.loop will be deprecated. This change also resolved several diagnostics raised by LuaLS/LazyDev in this module.

Thanks!

@dbluhm
Copy link
Author

dbluhm commented Jun 13, 2025

Friendly nudge @Conni2461. This should be a pretty straightforward change with no difference in behavior at runtime, just QOL improvement for type checking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant