LuaLS / LuaLS/lua-language-server
---@template<class: T1, class: T2>
Đang mở
Chưa có ai nhận issue này.
enhancement
feat/generic
- Ngôn ngữ chính
- Lua
- Star
- 4.4k
- Fork
- 442
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với bản tái hiện bằng Lua trong issue, tập trung vào các annotation kế thừa @template và @class cũng như các kiểu ожидаđợi cho parent và activeObjects. Theo dõi cách language server hiện diễn giải các annotation này, sau đó xác minh rằng ví dụ vẫn giữ lại cả hai tham số template và phân giải các trường được hiển thị thành Frame1/Frame2 và Button1[]/Button2[].
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- lua
- Lĩnh vực
- devtools
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100