Skip to content

Conversation

@agu-z
Copy link
Collaborator

@agu-z agu-z commented Jun 8, 2024

When we load a module as the root (e.g roc check Module.roc), the compiler would hang when it encountered an import from a package. This happened because it would wait for the package shorthand to be resolved, but it never would because the main module (app/package) wouldn't be loaded.

In this case, we will now recursively search for a main.roc file starting from the module's directory, and then parse its header and load the packages it specifies. We will not load the defs of the main module to avoid unnecessarily checking the whole tree.

If the user wants to name the app something different, they can use a new --main CLI flag when running roc check/roc dev. We don't have a way to specify this for the language server yet, but we should add it in the future.

Finally, this adds proper reporting for unrecognized package shorthands. We will suggest from the available options, and indicate which main we are using to help troubleshoot when applicable.

Closes #6538
Closes #6185
Closes #6200
Closes #6388
Closes #6373
Closes #5961

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was some dead code I found

@lukewilliamboswell
Copy link
Collaborator

Thank you very much 😀

Copy link
Collaborator

@lukewilliamboswell lukewilliamboswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works great. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment