LuaLS / LuaLS/lua-language-server

Putting Bitwise operators in function param does not provide completion

Aperta
#1,748 0 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?

Annotations

Reproduction steps

I have the following code

local FONTFLAG_NONE = 0
local FONTFLAG_ITALIC = 0x001
local FONTFLAG_UNDERLINE = 0x002
local FONTFLAG_STRIKEOUT = 0x004
local FONTFLAG_SYMBOL = 0x008
local FONTFLAG_ANTIALIAS = 0x010
local FONTFLAG_GAUSSIANBLUR = 0x020
local FONTFLAG_ROTARY = 0x040
local FONTFLAG_DROPSHADOW = 0x080
local FONTFLAG_ADDITIVE = 0x100
local FONTFLAG_OUTLINE = 0x200
local FONTFLAG_CUSTOM = 0x400
local FONTFLAG_BITMAP = 0x800

---@alias FontFlags
---| `FONTFLAG_NONE` # 0
---| `FONTFLAG_ITALIC` # 1 (0x001)
---| `FONTFLAG_UNDERLINE` # 2 (0x002)
---| `FONTFLAG_STRIKEOUT` # 4 (0x004)
---| `FONTFLAG_SYMBOL` # 8 (0x008)
---| `FONTFLAG_ANTIALIAS` # 16 (0x010)
---| `FONTFLAG_GAUSSIANBLUR` # 32 (0x020)
---| `FONTFLAG_ROTARY` # 64 (0x040)
---| `FONTFLAG_DROPSHADOW` # 128 (0x080)
---| `FONTFLAG_ADDITIVE` # 256 (0x100)
---| `FONTFLAG_OUTLINE` # 512 (0x200)
---| `FONTFLAG_CUSTOM` # 1024 (0x400)
---| `FONTFLAG_BITMAP` # 2048 (0x800)

---@param name string
---@param height integer
---@param weight integer
---@param flags FontFlags|integer
---@return integer
---@nodiscard
function draw.CreateFont(name, height, weight, flags) end

image
Here, type completion does provide suggestion if param has not been filled

image
After that, i input a | character and open suggestion dialog again, and there's no more FontFlags type

I found a "hack" that works by changing function prototype

---@param name string
---@param height integer
---@param weight integer
---@param ... FontFlags|integer
---@return integer
---@nodiscard
function draw.CreateFont(name, height, weight, ...) end

image

However this hack is not ideal

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

Riproduci il problema nell'estensione Visual Studio Code con le annotazioni Lua e il prototipo della funzione forniti. Inizia confrontando il completamento prima e dopo l'inserimento di | nel parametro flags; il lavoro è completato quando i suggerimenti FontFlags rimangono disponibili dopo l'operatore bitwise.

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

Valutazione

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.