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

Use the rust-analyzer package from the alpine repo #70

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

B3RR10
Copy link

@B3RR10 B3RR10 commented May 15, 2022

The rust-analyzer binary is already in the edge/community package repository from Alpine. Using this package instead of the component from rustup makes the container 500 MB smaller and avoids using the nightly toolchain.

@erikreinert
Copy link
Contributor

Dang! This is a great catch - we were just talking about image sizes on stream. I will test this out now!

@erikreinert
Copy link
Contributor

So I tested this - one thing to note is the previous image was probably about 500mb more due to the tooling that was also included (formatter, etc). With this approach - we are removing those tools and just installing the rust-analyzer.

I don't know what the best option is here as when you try to do something like format in neovim it fails saying rust formatter is not present. This will be the case for any tool that isn't installed in the container.

I would love to get feedback on IF we want this or not because we have other LSPs that also do this (Go comes to mind).

@erikreinert erikreinert self-assigned this May 17, 2022
@erikreinert erikreinert added help wanted Extra attention is needed enhancement New feature or request labels May 17, 2022
@B3RR10
Copy link
Author

B3RR10 commented May 18, 2022

Oh that is a good point... For formatting the code I use formatter.nvim, which uses the rustfmt binary on my system.

But I can see that it is also installed on the container, if someone wants that.

Is there any other tool that should be installed?

@B3RR10
Copy link
Author

B3RR10 commented May 18, 2022

So I tried a couple of things, but even with the minimal profile of the rust toolchain we end up with a 1.57 GB container. Compared to the 934 MB with "only" rust-analyzer. I'm not sure if the extra 600 MB just for rustfmt is worth it...

@erikreinert
Copy link
Contributor

To follow up on this - I think having formatting out of the box is pretty important to provide the best developer experience possible. I also think part of the challenge here is these tools are just really bulky. We can try merging this but I do think we'd want to include the formatter as it integrates directly with the LSP before we do.

@WhyNotHugo
Copy link
Contributor

Can we just add the rustfmt package to the apk add line? It's only 5MB, while saving 500MB.

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

Successfully merging this pull request may close these issues.

3 participants