With a rust workspace, ALE starts rust-analyzer at the crate root instead of workspace root

Open
#5,120 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
62/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust, vim
Domain
tooling

Research direction

Start at the named entry point ale_linters#rust#analyzer#GetProjectRoot and reproduce the behavior with a Cargo workspace containing multiple crates. Review the attached analyzer.patch and trace how rust-analyzer is launched for each crate. Done means workspace files use one workspace-root analyzer instance without introducing the ghost characters reported with system.

Written by the indexing model from the issue text.

Description

bug

Information

VIM version

VIM - Vi IMproved 9.2 (2026 Feb 14, compiled Apr 07 2026 19:00:59)
Included patches: 1-316

Operating System: Linux x1 6.19.11-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 02 Apr 2026 23:33:01 +0000 x86_64 GNU/Linux

What went wrong

Rust analyzer's ale_linters#rust#analyzer#GetProjectRoot find the project root by finding the nearest Cargo.toml files. When working with a cargo workspace, there are multiple Cargo.toml files. Current code starts a different instance of rust-analyzer for each crate in the workspace- but rust-anaylzer is aware of cargo workspaces, and can be started at the workspace root and shared among all crates in it, which improves cache utilization and reduces memory consumption, since dependencies of multiple crates in the workspace are analyzer once instead of per crate (this includes the workspace crates themselves which usually depend on each other).

Reproducing the bug

  1. Create a cargo workspace with multiple crates
  2. edit rust files under each of those crates
  3. multiple instances of rust-analyzer will be running

I've attached a patch which fixes the bug- however the patch uses system, which at least on my machine causes ghost characters to sometimes appear (I assume due to some sort of bad behavior of running system in the background while the user is typing, though honestly I'm not sure).

analyzer.patch

Dominant language
Vim Script
Stars
14k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dense-analysis/ale

All issues in dense-analysis/ale

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.