lua-language-server
lua-language-server copied to clipboard
`module()` function isn't respected by the language server
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
When module() is used in a script, functions defined "globally", like so:
module("MyExampleModule")
function HelloWorld() end
Are understood by the language server to belong to the table at _G.MyExampleModule
Actual Behaviour
Using the above example, the language server incorrectly believes HelloWorld() is at _G.HelloWorld() as opposed to _G.MyExampleModule.HelloWorld()
Reproduction steps
- Copy the above example into a file
- Create another file in the same workspace
- Type "Hello"
- Observe that the autocomplete suggests the function
_G.HelloWorld(), which does not exist
Additional Notes
This cannot be worked around with setfenv()
Log File
N/A