lua-language-server icon indicating copy to clipboard operation
lua-language-server copied to clipboard

`module()` function isn't respected by the language server

Open Sprixitite opened this issue 1 year ago • 0 comments

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

  1. Copy the above example into a file
  2. Create another file in the same workspace
  3. Type "Hello"
  4. 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

Sprixitite avatar Oct 18 '24 18:10 Sprixitite