LuaLS / LuaLS/lua-language-server
Feature Request: Support array table diagnose when a constant variable as key in lua 5.4
未关闭
还没有人认领这个 Issue。
- 主要语言
- 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?
Diagnostics/Syntax Checking
Expected Behaviour
It would be nice if when trying to use a constant variable as key of array the hint is also right. Thanks
`local ONE_INDEX = 1
---@class Test
---@field [1] math
local _M = {
math
}
-- hint the math
_M[ONE_INDEX].floor(1.1)`
Actual Behaviour
can't recognize the object
Reproduction steps
Empty
Additional Notes
No response
Log File
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先在 VS Code extension 中复现 Lua 5.4 示例,并跟踪使用 变量进行索引时的诊断或类型推断路径。当 language server 将 _M[ONE_INDEX] 识别为带注解的数组项,并在没有无关回归的情况下提供预期提示时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- lua
- 领域
- devtools
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100