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
LuaLS should have an annotation to assume a global is already defined. I looked in the documentation and didn't see one, but correct me if I'm wrong.
Actual Behaviour
In Neovim, vim is defined as a global in the Lua init file, which LuaLS complains about. This is frequently worked around by adding it as a global setting to LuaLS, but imo this is a monkey patch because non-Neovim Lua code may benefit from a diagnostic for a missing vim global.
It also doesn't help for other programs that embed Lua and define their own globals. HammerSpoon defines hs and mpv defines mp. In these cases the diagnostic can be circumvented with a require but it's not idiomatic in these domains and doesn't work for Neovim.
Reproduction steps
Edit NeoVim, HammerSpoon, or mpv script
Add vim, hs, or mp to the respective script
Run LuaLS on the script
Additional Notes
No response
Log File
No response
The text was updated successfully, but these errors were encountered:
How are you using the lua-language-server?
NeoVim
Which OS are you using?
MacOS
What is the issue affecting?
Diagnostics/Syntax Checking
Expected Behaviour
LuaLS should have an annotation to assume a global is already defined. I looked in the documentation and didn't see one, but correct me if I'm wrong.
Actual Behaviour
In Neovim,
vim
is defined as a global in the Lua init file, which LuaLS complains about. This is frequently worked around by adding it as a global setting to LuaLS, but imo this is a monkey patch because non-Neovim Lua code may benefit from a diagnostic for a missingvim
global.It also doesn't help for other programs that embed Lua and define their own globals. HammerSpoon defines
hs
and mpv definesmp
. In these cases the diagnostic can be circumvented with arequire
but it's not idiomatic in these domains and doesn't work for Neovim.Reproduction steps
vim
,hs
, ormp
to the respective scriptAdditional Notes
No response
Log File
No response
The text was updated successfully, but these errors were encountered: