LuaLS / LuaLS/lua-language-server
Autocompletion is not offered for a parameter with a `@class` type
還沒有人認領這個 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?
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:

### 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:

Until I press CTRL + Space:

### Reproduction steps
1. Use the below code:
```lua
---@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

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_
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
issue 中沒有指定原始碼檔案或測試。首先在 VS Code 擴充功能中執行提供的 Lua 重現,並追蹤為 `Options` 參數輸入 `{` 後的補全行為;當 `@class` 欄位無需按下 Ctrl+Space 即可自動提供時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- lua
- 領域
- devtools
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100