You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The _G class is defined in extension's basic.lua, representing the global vairable. I expected the following should merge the defined fields into the global variable.
---@class_G---@fieldplayer_mininteger---@fieldplayer_maxintegerprint(p--[[should have autocompletion]])
print(_G.p--[[should have autocompletion]])
Actual Behaviour
LuaLs recognized the injected field in the hover preview of _G, however no autocompletion for those fields are provided, unless I write _G._G.*.
---@class_G---@fieldplayer_mininteger---@fieldplayer_maxintegerprint(p--[[no autocompletion]])
print(_G.p--[[no autocompletion]])
print(_G._G.p--[[!!! has autocompletion !!!]])
Reproduction steps
Use the code snippet provided above.
Additional Notes
LuaLS actually recognized the injected fields in the hover preview of _G, just the autocompletion is not working as expected.
Meanwhile the workaround is the use ---@type annotation for global variable. However as discussed here, unless the global variable is of table type, otherwise any default value assigned to it will be misleading as the global variable may not be a const.
Log File
No response
The text was updated successfully, but these errors were encountered:
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
The
_G
class is defined in extension'sbasic.lua
, representing the global vairable. I expected the following should merge the defined fields into the global variable.Actual Behaviour
LuaLs recognized the injected field in the hover preview of
_G
, however no autocompletion for those fields are provided, unless I write_G._G.*
.Reproduction steps
Use the code snippet provided above.
Additional Notes
LuaLS actually recognized the injected fields in the hover preview of
_G
, just the autocompletion is not working as expected.Meanwhile the workaround is the use
---@type
annotation for global variable. However as discussed here, unless the global variable is of table type, otherwise any default value assigned to it will be misleading as the global variable may not be a const.Log File
No response
The text was updated successfully, but these errors were encountered: