LuaLS / LuaLS/lua-language-server
[Feature Request] @mixin - @class specific syntax to define applied mixins
Chưa có ai nhận issue này.
- 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ả
What
A way to indicate that the members of a @class type are applied to a subject @class outside of the inheritance chain
Technical
@mixin type, ...
Adds the values of type, ... to the subject class' definition. Mixins are applied in the order they are specified; values of the same key are overwrote as each mixin is processed
Example
This:
---@class Mixin1
---@field foo number
---@field bar number
---@class Mixin2
---@field bar string
---@field baz string
---@class Subject
---@field key boolean
---@field foo boolean
---@mixin Mixin1, Mixin2
Would get interpreted as
---@class Subject
---@field key boolean (defined by field; wasn't altered by mixins)
---@field foo number (defined by field, overwrote by mixin1, not overwrite by mixin2)
---@field bar string (defined by mixin1, overwrite by mixin2)
---@field baz string (defined by mixin2)
Use case
I currently have sub-classes that get assigned valves from reusable dictionary tables outside their inheritance chain. The only way to document those modifications is to statically define the fields each time a mixin is applied
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
Không có tệp hoặc bài kiểm thử nào được nêu. Hãy bắt đầu bằng cách theo dõi cách language server phân tích các chú thích @class hiện có và tính kế thừa, sau đó xác định vị trí phù hợp cho việc áp dụng @mixin theo thứ tự và ghi đè trường. Được xem là hoàn tất khi cú pháp được phân tích theo các quy tắc ưu tiên đã nêu và được bao phủ bởi các bài kiểm thử cho nhiều mixin và các xung đột.
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