LuaLS / LuaLS/lua-language-server
Wrong edit range for param completions
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Lua
- Star
- 4.4k
- Fork
- 442
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Tái hiện vấn đề bằng ví dụ test.lua và Neovim, tập trung vào các phạm vi chỉnh sửa của tính năng hoàn tất đối với một tham số có kiểu my_type|my_type[]. Theo dõi cách phạm vi hoàn tất được tính toán khi đối số nằm bên trong dấu ngoặc nhọn. Được xem là hoàn tất khi việc chọn một mục hoàn tất chỉ thay thế giá trị bên trong dấu ngoặc nhọn và giữ nguyên cú pháp danh sách xung quanh.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- lua, neovim
- Lĩnh vực
- developer-experience, tooling
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 58/100