dense-analysis / dense-analysis/ale

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
bug
Dominant language
Vim Script
Stars
14k
Forks
1.5k
Avg merge
17h 49m
Merged PRs (30d)
1

Description

## 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](https://github.com/user-attachments/files/26707694/analyzer.patch)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.