LuaLS / LuaLS/lua-language-server
Enhancement ---@fieldread, ---@fieldwrite or attribute modifiers on typing
還沒有人認領這個 Issue。
- 主要語言
- Lua
- 星號
- 4.4k
- 分支
- 442
- PR 合併指標
- 30 天內沒有已合併 PR
描述
When using some c api's (In my case Factorio's modding api) when you retrieve a value you get one type, but you can set it with multiple different types.
```lua
---@class Surface
---@class Player
local Player = {}
---@fieldread surface Surface
---@fieldwrite surface Surface|string
local p = Player.surface --- p is Surface
p.surface = "Other Surface" --No warnings
```
Another thought I had was attribute types, which would more easily support more attributes in the future
```lua
---@field{read} surface Surface
---@field{write} surface Surface|string
---@field{read,write} surface -- the default if no attributes are supplied
```
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
該 issue 沒有指定檔案、測試或進入點。首先定位 language server 對 Lua 欄位註解和型別檢查的處理,然後將提議的 @fieldread/@fieldwrite 語法和屬性語法與現有的註解行為進行比較。完成的標準是確定一種支援獨立讀取型別和寫入型別的語法,並產生預期的警告行為。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- lua
- 領域
- tooling
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100