Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require of files from other workspaces #1567

Closed
ghost opened this issue Sep 20, 2022 · 2 comments
Closed

Require of files from other workspaces #1567

ghost opened this issue Sep 20, 2022 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@ghost
Copy link

ghost commented Sep 20, 2022

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:
br-mw-require-expected
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:
br-mw-require1
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).
br-mw-require2
Within the workspace w3 whose name is the start of the workspace w35, w35/G.lua can be required.

Reproduction steps

  1. Open a new folder within VSCode.
  2. 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>.
  3. Create a new Lua file within the second folder which returns something, e.g., a number, string or table.
  4. 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

@sumneko
Copy link
Collaborator

sumneko commented Sep 22, 2022

Each workspace has its own private environment.
You need use Lua.workspace.library.

@ghost
Copy link
Author

ghost commented Sep 26, 2022

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.

@sumneko sumneko added the bug Something isn't working label Sep 30, 2022
@sumneko sumneko added this to the 3.6.0 milestone Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant