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

Unable to apply two detected libraries #1558

Closed
carsakiller opened this issue Sep 16, 2022 · 3 comments
Closed

Unable to apply two detected libraries #1558

carsakiller opened this issue Sep 16, 2022 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@carsakiller
Copy link
Collaborator

You cannot use the automatic library detection to apply two libraries. For example, with #1556, you would want to apply both busted and luassert, while still having them be separate.

This is due to "Lua.workspace.checkThirdParty" being set to false in the workspace's settings when a library is applied automatically. After this is set, the server no longer tries to apply libraries. This should instead save an array of paths to (or names of) the libraries that have been applied or explicitly ignored. This would allow multiple libraries to be applied automatically.

@carsakiller
Copy link
Collaborator Author

I thought of a solution for this use case… because Busted is dependent on luassert, I added the following to Busted's config.lua:
https://github.com/sumneko/lua-language-server/blob/d8b2c479a8ac1b227ed32ba74c62cca22e4896ef/meta/3rd/busted/config.lua#L6-L12

Now when Busted is applied, it will automatically apply luassert as well 🙂.

I still think the original issue needs addressing though. For example, what if I want to use OpenResty with Busted - but not always?

@carsakiller carsakiller added the enhancement New feature or request label Sep 17, 2022
@flrgh
Copy link
Contributor

flrgh commented Sep 17, 2022

Ah! This is an issue I've wanted to raise for a long while but haven't gotten around to 🙃

I ran into this early on with the language server. With neovim my lua-language-server configuration is dynamically generated at startup, allowing me to customize the configuration on a per-machine, per-workspace basis. In practice, I always know which projects use which libraries, so most of it boils down to "this workspace uses OpenResty+Penlight+lfs" or "this workspace uses neovim+luv+etc."

Making 3rd party library detection feature support multiple libraries for a single workspace would be a win for the vscode users while also allowing me to delete a lot of the over-engineered cruft from my neovim confs :)

@sumneko sumneko added this to the 3.6.0 milestone Sep 19, 2022
@carsakiller
Copy link
Collaborator Author

That was fast, thanks! ❤️🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants