Replies: 1 comment
-
I assume you are talking about global functions that implemented by you libraries. LuaLS treats this single workspace as a single (Lua) runtime. It means that it treats all lua files (which are not in See another discussion here why LuaLS cannot dynamically add things to the global: #3187 (comment) My personal advice is avoid using globals in your libraries 😇
local mylib = {}
function mylib.hello()
print("hello")
end
function mylib.world()
print("world")
end
return mylib
local mylib = require "mylib"
mylib. --> Ctrl+Space here will suggest `hello()` and `world()`
-- such that mylib.* will not pollute the global namespace And if your project has different runtime/env for different set of files, you may also consider using multi-root workspace. This makes each set of you files have a separate runtime. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
AS you saw the title, And the libraries too
I want to reference only the functions from the file that I'm currently opening AND the libraries I included in the Lua
When I hit Ctrl+Space I should see only functions from opening file and the libraries that I have included, how to do that?
Beta Was this translation helpful? Give feedback.
All reactions