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

Add rust-analyzer to dev dockerfile #963

Closed
wants to merge 1 commit into from

Conversation

NickeZ
Copy link
Collaborator

@NickeZ NickeZ commented Aug 8, 2022

This setup works for me, unless I'm being confused. I configure vim to run ra.sh and I start vim in the src/rust directory.

@benma
Copy link
Collaborator

benma commented Aug 9, 2022

Even in the bitbox02-rust crate, which depends on the C stuff?

I've been meaning to look into #819 again - if that one works, is this one still needed?

@NickeZ
Copy link
Collaborator Author

NickeZ commented Aug 9, 2022

yeah, I tried the lsp hover function on some stuff and it seems to work everywhere.

This has a different approach to the other PR. In the other PR I tried to make RA work on the developers machine. In this PR RA is run in the docker container. So this PR is much smaller and easier to maintain I would say. The drawback of this approach is that you need to configure your editor to call ra.sh instead of rust-analyzer for this specific project. In vim I can just have a local vimrc file in the project folder. So it isn't a problem. Not sure how you do in Emacs.

@benma
Copy link
Collaborator

benma commented Aug 15, 2022

A bit confused, why does rust-analyzer need to run inside Docker, is there anything special inside the Docker container? Could it also run on the host?

Asking because adding it to the Dockerfile has at least these downsides:

  • building the image takes a lot longer, detrimental to reproducible builds
  • updating rust-analyzer should be done quite frequently I imagine

@NickeZ
Copy link
Collaborator Author

NickeZ commented Aug 15, 2022

rust-analyzer is technically a compiler, so it requires almost everything that you have in the docker container. The only way to make it work outside the container is to install most of those dependencies on your dev machine.

edit: It doesn't to the linking step. But it has to do all the other steps (e.g., macro expansion, type resolution, run build scripts) to create the autocompletions.

@benma
Copy link
Collaborator

benma commented Aug 15, 2022

Most of the deps means just the Rust toolchain or more? Cause installing the Rust stuff is not a big barrier imo.

I tried getting this PR to work in my environment, no luck yet. Will try again.

@NickeZ
Copy link
Collaborator Author

NickeZ commented Aug 16, 2022

I don't remember exactly, but you need to be able to generate C headers, rust bindings. If you look at the other PR you can see that there are some changes so that the build scripts can detect if they are run under cmake or not.

@NickeZ NickeZ closed this Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants