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