LuaLS / LuaLS/lua-language-server
---@template<class: T1, class: T2>
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
### How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
### Which OS are you using?
Windows
### What is the issue affecting?
Other
### Expected Behaviour



### Actual Behaviour



### Reproduction steps
Is it possible to implement this annotation method?
```lua
---@diagnostic disable: missing-return
function CreateFramePool(...) end
function CreateFrame(...) end
---@template
---@class ObjectPoolMixin
---@field creationFunc fun(self: self)
---@field resetterFunc fun(self: self, object: T)
---@field activeObjects T[]
---@field inactiveObjects T[]
---@field hashinactiveObjects T[]
---@field numActiveObjects integer
ObjectPoolMixin = {};
---@template
---@param creationFunc fun(self: T)
---@param resetterFunc fun(self: self, object: T)
function ObjectPoolMixin:OnLoad(creationFunc, resetterFunc) end
---@template
---@return T object
---@return boolean isNew
function ObjectPoolMixin:Acquire() end
---@template
---@class FramePoolMixin: ObjectPoolMixin
---@field parent T1
FramePoolMixin = {};
---@class Button1
---@field a table
---@field b integer
local Button1 = {};
---@class Button2
---@field c string
---@field d number
local Button2 = {};
---@class Frame1
local frame1 = CreateFrame("Frame");
---@class Frame2
local frame2 = CreateFrame("Frame");
---@class Frame1Pool: FramePoolMixin
frame1.pool = CreateFramePool("Button", frame1);
---@class Frame2Pool: FramePoolMixin
frame2.pool = CreateFramePool("Button", frame2);
local parent1 = frame1.pool.parent; -- Should be defined as Frame1
local parent2 = frame2.pool.parent; -- Should be defined as Frame2
local activeObjects1 = frame1.pool.activeObjects; -- Should be defined as Button1[]
local activeObjects2 = frame2.pool.activeObjects; -- Should be defined as Button2[]
local button1 = activeObjects1[1]; -- Should be defined as Button1 or nil
local button2 = activeObjects2[1]; -- Should be defined as Button2 or nil
```
### Additional Notes
_No response_
### Log File
_No response_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Lua reproduction in the issue, focusing on the @template and @class inheritance annotations and the expected types for parent and activeObjects. Trace how the language server currently interprets these annotations, then verify that the example preserves both template parameters and resolves the shown fields as Frame1/Frame2 and Button1[]/Button2[].
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100