LuaLS / lua-language-server

A language server that offers Lua language support - programmed in Lua
https://luals.github.io
MIT License
3.38k stars 319 forks source link

[Request] Enum bitfield? #1876

Open Frouk3 opened 1 year ago

Frouk3 commented 1 year ago
---@enum eStopFlags bitfield
eStopFlags = {
    STP_PHYSICAL_OBJECTS = 1,
    STP_NONPHYSICAL_OBJECTS = 2,
    STP_PLAYER = 4,
    STP_UPDATE = 8,
    STP_PHYSICS = 16,
} 
if g_StopFlags & (eStopFlags.STP_PHYSICAL_OBJECTS | eStopFlags.STP_UPDATE) then
    print("Can't update physical objects")
end
sumneko commented 1 year ago

I don't know what you want.

Frouk3 commented 1 year ago

I don't know what you want.

it should hint user when bitwise is detected

---@enum eStpFlags bitwise
eStpFlags = {
  0x1 = STP_PHYSICS,
  0x2 = STP_OBJECTS,
  0x4 = STP_ETCOBJECTS
}
---@type eStpFlags
local g_StpFlags = 0
if g_StpFlags & (--[[hint: eStpFlags.STP_PHYSICS, eStpFlags.STP_OBJECTS, eStpFlags.STP_ETCOBJECTS]]) ...