-
-
Notifications
You must be signed in to change notification settings - Fork 391
Open
Labels
enhancementNew feature or requestNew feature or request
Description
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Linux
What is the issue affecting?
Diagnostics/Syntax Checking
Expected Behaviour
local extract0 = bit32 and bit32.extract -- Lua 5.2/Lua 5.3 in compatibility mode
local extract = _G.bit32 and _G.bit32.extract -- Lua 5.2/Lua 5.3 in compatibility modeExpected: No error
Actual Behaviour
Error on 2nd line:
(global) _G.bit32: unknown
Undefined fieldbit32.Lua Diagnostics.(undefined-field)
Reproduction steps
- Add 'bit32' to globals;
- Errors on 1st line disappeared; but errors on 2nd line persists.
Additional Notes
sumneko.lua-3.6.18-linux-x64
Real global variables does not trigger errors. Only Lua.diagnostics.globals items lead to errors.
Additional question: how to mute errors for this pattern?
if _G.bit then -- LuaJIT
local shl, shr, band = _G.bit.lshift, _G.bit.rshift, _G.bit.band
...
end@diagnostic disable: mute too much, but @diagnostic disable-line: mute too little.
Log File
No response
stevenxxiu and NyaMisty
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request