polars
polars copied to clipboard
rust-analyzer not resolving `col` and other `Expr`
Polars version checks
-
[X] I have checked that this issue has not already been reported.
-
[X] I have confirmed this bug exists on the latest version of Polars.
Issue description
The code compiles. However, when working with the rust-analyzer it seems like the array of Expr
expressions are not resolved. Here is a screenshot where we see how LazyFrame
is resolved, but the collection (array) of Expr
aren't (highlighted in red).
I'm not sure whether this is a rust-analyzer issue, or whether polars needs to include information to help resolve it.
Reproducible example
let summary = df.lazy().groupby(["subject_idx"]).agg([
col("prop_score_bin").first(),
col("subject_idx_ctrl").count().alias("micro_pool_size"),
]);
Expected behavior
The rust-analyzer should have a way to resolve this code.
That's something that's up for rust-analyzer.
To help describe the issue, I have the following series of references to find col
located in the dsl
module:
polars::prelude::* -> polars_lazy::prelude::* -> crate::dsl::*
Is that how you would describe it?
This probably isn't the best solution, but for now I have been directly installing polars_plan and sourcing with use polars_plan::dsl::col;
In general this may be a case of pathological cascading public modules. pub use::* and use super::* are all over the place. It compiles, but its obviously confusing for Rust Analyzer, not to mention anyone new browsing the code base trying to figure out what's actually in scope without navigating to dozens of ::* imports.