LuaLS / LuaLS/lua-language-server
Multiple return values for fields
未关闭
还没有人认领这个 Issue。
feat/LuaCats Annotations
- 主要语言
- Lua
- 星标
- 4.4k
- 派生
- 442
- PR 合并指标
- 30 天内没有已合并 PR
描述
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?
Annotations
Expected Behaviour
The ability to define multiple return values for a field annotation.
Actual Behaviour
Any non-identifier symbol following a type is treated as a comment or a break.
Reproduction steps
- Create a field with a comma separated return type.
- See that anything following the comma is treated as a comment.
Additional Notes
---@class Color
---@field [string] Color,string
Color = {}
,string is highlighted as a comment.
---@class Color
---@field [string] Color, string
Color = {}
, is highlighted as a symbol, string is highlighted as a comment.
An example of fields with multiple return types are the named color lookups in the Tabletop Simulator API:
https://api.tabletopsimulator.com/color/#colorblue
local color, name = Color.Blue
print(color) -- Color: Blue { r = 0.118, g = 0.53, b = 1, a = 1 }
print(name) -- Blue
local color, name = Color.Red
print(color) -- Color: Red { r = 0.856, g = 0.1, b = 0.094, a = 1 }
print(name) -- Red
Log File
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先使用提供的 Lua 代码片段复现注解解析器的行为,重点关注 @field 声明后以逗号分隔的类型是如何被分词的。完成的标准是:Color,string 这样的多个返回类型会被识别为注解类型,而不是将其余部分视为注释;如果 repository 中有相关的解析器测试,请添加或更新覆盖率。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- lua
- 领域
- devtools
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100