LuaLS / LuaLS/lua-language-server

Autocompletion is not offered for a parameter with a `@class` type

Đang mở
#1,439 23 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

enhancement
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?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Completion

Expected Behaviour

When using a defined class as the type for a parameter, the fields of that table should be offered as an autocompletion when calling the function.

For an example, using @alias works like so:
image

Actual Behaviour

No autocompletion is automatically offered when using @class as the type for a parameter. If you press CTRL + Space, you can make the completions appear, but they will not appear automatically.

Nothing is offered:
image
Until I press CTRL + Space:
image

Reproduction steps
  1. Use the below code:
    ---@class Options
    ---@field page number
    ---@field active boolean
    
    ---@param opts Options
    local function acceptOptions(opts) end
    
    acceptOptions()
    
  2. Move your cursor to line 9 (acceptOptions()) and place it between the parentheses
    image
  3. Enter { to start a table literal
  4. No completions are offered
  5. Press CTRL + Space and notice that the first 2 options are actually proper completions from the Options class. These should automatically be offered.
Additional Notes

No response

Log File

No response

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Issue không nêu tệp mã nguồn hoặc bài kiểm thử nào. Hãy bắt đầu bằng cách chạy reproduction Lua được cung cấp trong extension VS Code và theo dõi hành vi hoàn thành mã sau khi nhập { cho tham số Options; hoàn tất khi các trường @class được tự động đề xuất mà không cần nhấn Ctrl+Space.

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
Lĩnh vực
devtools
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.