esp-rs/espup

rust-analyzer support

oleid opened this issue · 5 comments

oleid commented

Motivations

When I set up an esp32 toolchain via espup and use the cargo template, I end up with non-working rust-ananlyzer:

error: 'rust-analyzer' is not installed for the toolchain 'esp'
note: this is a custom toolchain, which cannot use `rustup component add`
help: if you built this toolchain from source, and used `rustup toolchain link`, then you may be able to build the component with `x.py`

One can work-around this by manually linking rust-analyzer from a different toolchain to the binary folder of esp, yet this will only partially work, since rust-ananlyzer won't be able to load .so files of the proc-macros.

image

Solution

It would be best to provide rust-analyzer directly via espup.

Alternative

For convenience, one could auto-link rust-analyzer to the binary of the current default toolchain.

Do you have any suggestion on how we could solve this in espup? espup basically, downloads the artifacts generated in https://github.com/esp-rs/rust-build

I think what would be needed, is the rust-analyzer-proc-macro-srv adjusted to recognise the ABI for esp.

We've had similar issues in the past, see esp-rs/esp-template#58, but I dont think we cant do much from the esp-rs organization.

I think the description of this issue is misleading. Rust-analyzer works except for the proc macro expansion but you are right this is nothing that can be fixed in espup. There are two ways I think this can be 'solved':

  1. Just disable proc macro expansion ( "rust-analyzer.procMacro.enable": false ) in the template where the custom xtensa rust tollchain is used
  2. Fix the unsupported ABI issue in esps rust fork

I'll close this issue as I don't think we can do anything else on our side and the issue does not really belongs here. Same applies to esp-rs/esp-template#58, esp-rs/esp-idf-template#74 and esp-rs/esp-template#90