-
-
Notifications
You must be signed in to change notification settings - Fork 337
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
[Feature Request] Multiple-project/Monorepo support #2962
Comments
The feature request might be reasonable, but it seems difficult to implement for the current LuaLS. It requires separating the indexing/cache of the project to different projects based on URI, which might need significant changes to the current LuaLS. |
(non-perfect solution)
I just found an extension Monorepo Workspace: https://marketplace.visualstudio.com/items?itemName=folke.vscode-monorepo-workspace
#!/bin/bash
cd drivers/SmartThing
current_dir=$(pwd)
for dir in */; do
if [ -d "$dir" ]; then
cd "$dir" || continue
subfolder_name=${dir%/}
echo "{ \"name\": \"SmartThings/$subfolder_name\" }" > package.json
cd "$current_dir" || exit
fi
done
hope that helps a bit before LuaLS can have a better support for monorepos 🙂 |
What I actually did was write a bash + jq script that generates a |
I see, but how do you dynamically add / remove folders to the workspace? The above suggested plugin's selection UI can do filtering on all detected sub folders, also it provides a |
Right now I just have it add everything 🤷♂️ |
I work with a large monorepo that contains multiple Lua project roots. You can actually see the list of Lua projects here, as an example: https://github.com/SmartThingsCommunity/SmartThingsEdgeDrivers/tree/main/drivers/SmartThings
Loading this entire repo at once doesn't work well because of how the
require
paths are established viaruntime.path
. The primary issue is that it leads to ambiguous require resolution if two of the roots have files with the same name.Obviously, one workaround is to use a multi-root workspace and only add the folders for the projects I currently care about, but that's tedious since I'd be adding and removing folders from the workspace constantly.
One idea that I had was being able to specify an "entrypoint" glob. The plugin could traverse up the directory tree looking for a file that matches the glob, and then use that as the root for all local requires. But that might not be a good "general" solution even though it works well for my use case.
The text was updated successfully, but these errors were encountered: