LuaLS / LuaLS/lua-language-server

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

Aperta
#1,439 23 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

enhancement
Lingua principale
Lua
Stelle
4.4k
Fork
442
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### 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](https://user-images.githubusercontent.com/61925890/182666707-4604246c-d5c6-4f00-b325-d0b63b66dc83.png)

### 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](https://user-images.githubusercontent.com/61925890/182667040-5db455a7-1c2b-4ee9-97c0-db98a972bcbc.png)
Until I press CTRL + Space:
![image](https://user-images.githubusercontent.com/61925890/182667128-2cf3aaad-de2d-4449-8198-503717acea9b.png)

### 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
![image](https://user-images.githubusercontent.com/61925890/182667557-19514c4a-8ba2-403c-b75c-e08f6677d75a.png)
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_

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Nell’issue non viene indicato alcun file sorgente né alcun test. Inizia eseguendo la riproduzione Lua fornita nell’estensione VS Code e traccia il comportamento del completamento dopo aver inserito `{` per il parametro `Options`; il lavoro è completato quando i campi `@class` vengono proposti automaticamente senza premere Ctrl+Space.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
lua
Ambito
devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.