Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotate generic classes as generic #5

Open
demiurgeQuantified opened this issue Mar 3, 2024 · 0 comments
Open

Annotate generic classes as generic #5

demiurgeQuantified opened this issue Mar 3, 2024 · 0 comments

Comments

@demiurgeQuantified
Copy link
Contributor

Right now all generic classes are represented without the generic aspect. Generic classes are not actually supported by LuaLS right now, but annotating them as generic would still benefit developers. For example, IsoCell.getZombieList is annotated as returning ArrayList - annotating this as ArrayList<IsoZombie> instead would save a visit to the javadocs.
The annotations for this are quite simple:

---@generic T
---@class ArrayList<T>

---@return ArrayList<IsoZombie>

Unfortunately, the type inference ArrayList<T>.get -> T is not possible with LuaLS's current lack of support for generic classes - class methods annotated with the generic get dropped by intellisense completely. Because of this, defining generic classes has no actual effect on the type checker, making this issue a low priority.

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

No branches or pull requests

1 participant