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

Helix fails to correctly configure rust analyzer? #12676

Open
tommasoclini opened this issue Jan 25, 2025 · 8 comments
Open

Helix fails to correctly configure rust analyzer? #12676

tommasoclini opened this issue Jan 25, 2025 · 8 comments
Labels
C-bug Category: This is a bug

Comments

@tommasoclini
Copy link

Summary

This is a sample project: https://github.com/tommasoclini/esp_rust_ws
Helix fails to work completely correctly, for example, when editing from the upper workspace directory, warnings on unused imports do not get shown in the app.
vscode works completely fine instead.

Reproduction Steps

I tried this:

Project layout in rust like this

I expected this to happen:

Language features should work correctly in both platform-agnostic and platform specific code.

Instead, this happened:

Language features do not work well in the app(platform specific part), while vscode and neovim do(neovim uses rustaceanvim to pick up settings from .vscode/settings.json).

Helix log

~/.cache/helix/helix.log

helix.log

Platform

Linux

Terminal Emulator

alacritty

Installation Method

source

Helix Version

helix 25.01.1 (899afad)

@tommasoclini tommasoclini added the C-bug Category: This is a bug label Jan 25, 2025
@yanshay
Copy link

yanshay commented Jan 27, 2025

I had issues with esp-generate projects in NeoVim and resolved it by restructuring projects to more standard main.rs under src.

Looks like your project is also structured like that based on this in cargo.toml

[[bin]]
name = "my_app"
path = "./src/bin/async_main.rs"

@tommasoclini
Copy link
Author

The even weirder thing is that neovim works well with my current project structure, what plugins did you use for rust?

@yanshay
Copy link

yanshay commented Jan 27, 2025

The even weirder thing is that neovim works well with my current project structure, what plugins did you use for rust?

I'm using LazyVim, it comes with rustaceanvim.

@tommasoclini
Copy link
Author

The even weirder thing is that neovim works well with my current project structure, what plugins did you use for rust?

I'm using LazyVim, it comes with rustaceanvim.

Me too, even weirder!

@yanshay
Copy link

yanshay commented Jan 27, 2025

Me too, even weirder!

All these configs are so complex and sensitive to exact versions of every tool that no two computers are alike.

I can say that in the last week or so I started having strange issues, like go-to-definition (gd) sometimes brings me to an empty file first time with error notifications (which I haven't read yet), second time it usually works, and other issues like that.
The only thing I changed recently was upgrade esp toolchain to the latest to work with the latest esp-hal. I don't see why it should affect this, but maybe it does.

@tommasoclini
Copy link
Author

tommasoclini commented Jan 27, 2025

Do you have the latest version of everything lazyvim related? Including neovim of course. Have you checked LazyHealth?
I manage my neovim installations with the bob crate: cargo install bob.

@yanshay
Copy link

yanshay commented Jan 27, 2025

Do you have the latest version of everything lazyvim related? Including neovim of course. Have you checked LazyHealth?

I updated yesterday LazyVim plugins, not sure if it updates everything (like Mason installations etc.)
Didn't yet have the energy to dive into these things.
LazyHealth looks fine.

I manage my neovim installations with the bob crate: cargo install bob.

Never heard of it, will check it out, thanks.

@tommasoclini
Copy link
Author

tommasoclini commented Jan 31, 2025

This is my project structure:

.
├── Cargo.toml
├── f1_car
│  ├── Cargo.toml
│  ├── rust-toolchain.toml
│  └── src
├── f1_car_lib
│  ├── Cargo.toml
│  └── src
│     └── car
├── README.md
├── rx
│  ├── Cargo.toml
│  └── src
├── rx_generic
│  ├── Cargo.toml
│  └── src
│     ├── framed
│     └── serial

Cargo.toml:

[workspace]
resolver = "2"
members = ["f1_car_lib", "rx", "rx_generic"]
exclude = ["f1_car"]

[workspace.dependencies]
cobs = { version = "0.2.3", default-features = false }
derive_more = { version = "1.0.0", default-features = false, features = [ "display", "error" ]}
serde = { version = "1.0.217", default-features = false, features = ["alloc", "derive"] }

f1_car/Cargo.toml:

[package]
name = "f1_car"
version = "0.1.0"
edition = "2021"

[[bin]]
name = "f1_car"
path = "./src/main.rs"

[dependencies]
# local crates
f1_car_lib = { path = "../f1_car_lib" }
rx = { path = "../rx" }
rx_generic = { path = "../rx_generic" }

# START default dependencies

embassy-net = { version = "0.6.0", features = [
  "dhcpv4",
  "medium-ethernet",
  "tcp",
  "udp",
] }
embedded-io = "0.6.1"
embedded-io-async = "0.6.1"
esp-alloc = { version = "0.6.0" }
esp-backtrace = { version = "0.15.0", features = [
  "esp32s3",
  "exception-handler",
  "panic-handler",
  "println",
] }
esp-hal = { version = "0.23.1", features = ["esp32s3", "unstable"] }
esp-println = { version = "0.13.0", features = ["esp32s3", "log"] }
esp-wifi = { version = "0.12.0", default-features = false, features = [
  "esp-alloc",
  "esp32s3",
  "log",
  "utils",
  "wifi",
] }
heapless = { version = "0.8.0", default-features = false }
log = { version = "0.4.21" }
smoltcp = { version = "0.12.0", default-features = false, features = [
  "medium-ethernet",
  "multicast",
  "proto-dhcpv4",
  "proto-dns",
  "proto-ipv4",
  "socket-dns",
  "socket-icmp",
  "socket-raw",
  "socket-tcp",
  "socket-udp",
] }
# for more networking protocol support see https://crates.io/crates/edge-net
critical-section = "1.2.0"
embassy-executor = { version = "0.7.0", features = ["task-arena-size-20480"] }
embassy-time = { version = "0.4.0", features = ["generic-queue-8"] }
esp-hal-embassy = { version = "0.6.0", features = ["esp32s3"] }
static_cell = { version = "2.1.0", features = ["nightly"] }

# END default dependencies

cobs = { version = "0.2.3", default-features = false }
embassy-sync = "0.6.1"
buffered-io = "0.5.4"
embedded-hal = "1.0.0"
uom = { version = "0.36.0", default-features = false }
edge-dhcp = "0.5.0"
edge-raw = "0.5.0"
edge-nal = "0.5.0"
edge-nal-embassy = "0.5.0"
serde_json = { version = "1.0.133", default-features = false, features = [
  "alloc",
] }
embedded-cli = "0.2.1"
esp-storage = { version = "0.4.0", features = ["esp32s3"] }
embassy-futures = "0.1.1"
futures = { version = "0.3.31", default-features = false, features = [
  "alloc",
  "async-await",
] }
embedded-hal-async = "1.0.0"
itertools = { version = "0.14.0", default-features = false, features = [
  "use_alloc",
] }
derive_more = { version = "1.0.0", default-features = false, features = [
  "display",
  "error",
] }

[features]
default = ["fast_pwm"]
fast_pwm = []

[profile.dev]
# Rust debug is too slow.
# For debug builds always builds with some optimization
opt-level = "s"

[profile.release]
codegen-units = 1        # LLVM can perform better optimizations using a single thread
debug = 2
debug-assertions = false
incremental = false
lto = 'fat'
opt-level = 's'
overflow-checks = false

Is there something wrong with it?
I've noticed sometimes neovim fails too, this is the error message from rust analyzer:

2025-01-31T20:09:30.338669325+01:00 ERROR FetchWorkspaceError: rust-analyzer failed to load workspace: Failed to load the project at /home/tommaso/git_repos/pfi/ehorizon_f1_sw/f1_car/f1_car/Cargo.toml: Failed to query rust toolchain version at /home/tommaso/git_repos/pfi/ehorizon_f1_sw/f1_car/f1_car, is your toolchain setup correctly?: cd "/home/tommaso/git_repos/pfi/ehorizon_f1_sw/f1_car/f1_car" && RUSTUP_TOOLCHAIN="esp" "/home/tommaso/.cargo/bin/cargo" "--version" failed: No such file or directory (os error 2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

2 participants