Updated README

This commit is contained in:
Maddox Werts 2025-01-19 10:13:05 -05:00
parent 8d7c1e392b
commit e8eb029e52

View file

@ -1,19 +1,30 @@
# Rust-LS <h1 align="center">Rust-LS</h1>
A Dockerized Rust Language Server <p align="center">A Dockerized Rust Language Server</p>
# Install steps
## Setting up Virtual Environments
The first and most important steps are to build the docker images, as they are the boilerplate of this language server. Just run the following commands while in the **Rust-LS** directory.
## Install steps
1. Build the docker image with the following command:
```bash ```bash
docker build . -t rust-ls ./scripts/cargo/docker.sh
``` ./scripts/rust-analyzer/docker.sh
2. Initilize your project's *Cargo.lock* file by creating a project with `Cargo Init [PROJECT_NAME]` and replace the following section of the **rust-ls** file *(Delete the text inside [])*:
```bash
docker run -i --rm -u $(stat -c '%u:%g' .) -v "$PWD:$PWD:[ro,z]Z" -w "$PWD" rust-ls "$@"
```
3. Open Visual Studio Code with the *rust-analyzer* extension, and edit the rust-analyzer server directory to where the **rust-ls** file is. Open your project directory and let it initilize.
4. Delete the junk *target* folder. and modify your **rust-ls* back to the original state
```bash
docker run -i --rm -u $(stat -c '%u:%g' .) -v "$PWD:$PWD:Z" -w "$PWD" rust-ls "$@"
``` ```
### You should be all set! After that, you'll want to trick your system into thinking you already have both installed on your actual machine. To do that, just run the following commands:
```bash
sudo ln -s /path/to/scripts/cargo/cargo /bin/cargo
sudo ln -s /path/to/scripts/rust-analyzer/rust-ls /bin/rust-anaylzer
```
To test if your setup works as intended, just run `rust-analyzer --version` and `cargo --version` and they should both spit back their respective versions.
## Setting up IDE
Download the *Rust-Analyzer* extension from the VSCode store and set the following paths:
Field|Path
---|---
Cargo|/bin/cargo
Server|/bin/rust-analyzer
After that, it *should* work as intended!