lua-language-server
lua-language-server copied to clipboard
Require of files from other workspaces
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
In VSCode with multiple workspaces, it is not possible to require files from other workspaces within a specific workspace.
Example:
From workspace/F.lua, no other Lua file (except the default ones) can be required.
Actual Behaviour
In workspaces whose names are the start of the names of other workspaces, files from the other workspaces can be required if they return something.
Example:
The name of workspace w is the start of the workspaces w1, w2, w3, w35, and workspace. Therefore, all files from these workspaces can be required (because all files return 5).
Within the workspace w3 whose name is the start of the workspace w35, w35/G.lua can be required.
Reproduction steps
- Open a new folder within VSCode.
- Add a new folder to VSCode to create a new VSCode workspace. The name of this second folder must be
<name of the first folder><some characters>. - Create a new Lua file within the second folder which returns something, e.g., a number, string or table.
- Create a new Lua file within the first folder, and type
require('within this file. The name of the file from the second folder should appear in the code completion.
Additional Notes
No response
Log File
No response
Each workspace has its own private environment.
You need use Lua.workspace.library.
In the screenshots, every directory corresponds to one LSP workspace, and the directory called workspace has its own environment as I cannot require the files from the other directories. However, in the directories w and w3, I can require files from certain other directories although it should not be possible as I did not set the Lua.workspace.library setting and want to keep the files of the directories separate. It seems that it is possible in a directory/workspace to require files from other directories/workspaces whose names equal the name of the former directory/workspace appended by a suffix. In the example, from directory/workspace w3, the files in the directory/workspace w35 can be required.