LuaLS / LuaLS/lua-language-server

Putting Bitwise operators in function param does not provide completion

Aberta
#1,748 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

enhancement
Linguagem predominante
Lua
Estrelas
4.4k
Forks
442
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Reproduza o problema na extensão do Visual Studio Code com as anotações Lua e o protótipo da função fornecidos. Comece comparando a conclusão antes e depois de inserir | no parâmetro flags; considera-se concluído quando as sugestões de FontFlags continuam disponíveis após o operador bit a bit.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
lua, vscode
Domínio
devtools
Tipo de issue
Bug
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Claramente especificada
Facilidade para iniciantes
52/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.