I’m encountering an issue with #[derive(Template)] in a Rust workspace using askama 0.13.0.
Both cargo check and build work fine, but rust-analyzer reports "template not found" errors depending on which crate it analyzes first.
This issue does not occur with askama 0.12.1.
Problem
In a workspace with two crates (a and b), each using #[derive(Template)] for their own templates folder:
- If rust-analyzer starts with
crates/a, a works, but b gets:
- If rust-analyzer starts with
crates/b, b works, but a gets:
It seems RA uses the first-analyzed crate’s templates folder for all crates.
Steps to Reproduce
See minimal example:
https://github.com/strickczq/askama-ra-error-in-workspace
- Clone and open the project in VS Code with rust-analyzer freshly.
- (
crates/a/lib.rs) Open this file, RA works.
- (
crates/b/lib.rs) Then open this file, RA reports error.
- (
crates/b/lib.rs) Run rust-analyzer: Restart Server, RA works now.
- (
crates/a/lib.rs) Reopen this file, RA reports error.
Expected
rust-analyzer finds each crate’s templates in its own templates folder.
Actual
rust-analyzer uses the first-analyzed crate’s templates folder, causing errors for others.
Environment
- rust: 1.85.1 (4eb161250 2025-03-15)
- rust-analyzer: 0.3.2370-standalone (588948f267 2025-04-06)
- askama: 0.13.0 (issue present; 0.12.1 works fine)
- OS: macOS 15.3.2 (24D81)
I’m encountering an issue with
#[derive(Template)]in a Rust workspace using askama 0.13.0.Both cargo check and build work fine, but rust-analyzer reports "template not found" errors depending on which crate it analyzes first.
This issue does not occur with askama 0.12.1.
Problem
In a workspace with two crates (a and b), each using
#[derive(Template)]for their own templates folder:crates/a, a works, but b gets:crates/b, b works, but a gets:It seems RA uses the first-analyzed crate’s templates folder for all crates.
Steps to Reproduce
See minimal example:
https://github.com/strickczq/askama-ra-error-in-workspace
crates/a/lib.rs) Open this file, RA works.crates/b/lib.rs) Then open this file, RA reports error.crates/b/lib.rs) Runrust-analyzer: Restart Server, RA works now.crates/a/lib.rs) Reopen this file, RA reports error.Expected
rust-analyzer finds each crate’s templates in its own templates folder.
Actual
rust-analyzer uses the first-analyzed crate’s templates folder, causing errors for others.
Environment