LuaLS / LuaLS/lua-language-server
---@template<class: T1, class: T2>
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Lua
- Sterne
- 4.4k
- Forks
- 442
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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?
---@diagnostic disable: missing-return
function CreateFramePool(...) end
function CreateFrame(...) end
---@template <class T>
---@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 <class T>
---@param creationFunc fun(self: T)
---@param resetterFunc fun(self: self, object: T)
function ObjectPoolMixin:OnLoad(creationFunc, resetterFunc) end
---@template <class T>
---@return T object
---@return boolean isNew
function ObjectPoolMixin:Acquire() end
---@template <class T1, class T2>
---@class FramePoolMixin: ObjectPoolMixin<T2>
---@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, Button1>
frame1.pool = CreateFramePool("Button", frame1);
---@class Frame2Pool: FramePoolMixin<Frame2, Button2>
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der Lua-Reproduktion im Issue und konzentriere dich auf die Vererbungsannotationen @template und @class sowie auf die erwarteten Typen für parent und activeObjects. Verfolge, wie der Language Server diese Annotationen derzeit interpretiert, und überprüfe anschließend, dass das Beispiel sowohl die Template-Parameter beibehält als auch die gezeigten Felder als Frame1/Frame2 und Button1[]/Button2[] auflöst.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- lua
- Bereich
- devtools
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100