LuaLS / LuaLS/lua-language-server
Wrong edit range for param completions
还没有人认领这个 Issue。
- 主要语言
- Lua
- 星标
- 4.4k
- 派生
- 442
- PR 合并指标
- 30 天内没有已合并 PR
描述
How are you using the lua-language-server?
NeoVim
Which OS are you using?
Linux
What is the issue affecting?
Completion
Expected Behaviour
For parameters that can either be a single value or a list T|T[], when already in a table, the completion range should not include surrounding curly braces.
Actual Behaviour
The completion edit range provided by lua-language-server for parameters seems to always include the entire parameter, which causes issues when completing params that can be either a single value or a list, for example, T|T[].
Reproduction steps
- Create
test.luain the test dir with the following content:---@alias my_type 'a'|'b' ---@param arg my_type|my_type[] local function test_func(arg) return arg end - Use neovim to edit
test.lua - Try to call
test_funcat the end of the file with a list parameter:test_func({ ... }) - Completions provided by lua-language-server are shown inside the curly braces
- Selecting one of the completions replaces the whole parameter, including the surrounding curly braces.
https://github.com/user-attachments/assets/d69214e9-b069-4554-b4ab-770e2fb50632
Additional Notes
I have also reported to the blink.cmp but the maintainer thinks that it is a lua-language-server's issue: https://github.com/Saghen/blink.cmp/issues/2179
Log File
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用 test.lua 示例和 Neovim 重现该问题,重点关注类型为 my_type|my_type[] 的参数的补全编辑范围。跟踪参数位于花括号内时补全范围的计算方式。完成的标准是:选择补全项时仅替换花括号内的值,并保留周围的列表语法。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- lua, neovim
- 领域
- developer-experience, tooling
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 冷清
- 描述清晰度
- 描述清楚
- 新手友好度
- 58/100