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

No intellisense when using query dsl #3876

Closed
ohuu opened this issue Dec 12, 2023 · 6 comments
Closed

No intellisense when using query dsl #3876

ohuu opened this issue Dec 12, 2023 · 6 comments
Labels

Comments

@ohuu
Copy link

ohuu commented Dec 12, 2023

Setup

Versions

  • Rust: 1.74.0
  • Diesel: 2.1.0
  • Database: Sqlite

Feature Flags

  • diesel: sqlite

Problem Description

When following the getting started guide everything works correctly. But, I get no intellisense when using the query dsl. For example: when querying the number of posts in the database, like this

use self::models::*;
use diesel::prelude::*;
use diesel_demo::*;

fn main() {
    use self::schema::posts::dsl::*;

    let connection = &mut establish_connection();
    let results = posts
        .filter(published.eq(true)) // <-- intellisense breaks after this line. All type info is lost although it compiles just fine!
        .limit(5)
        .select(Post::as_select())
        .load(connection)
        .expect("Error loading posts");

    println!("Displaying {} posts", results.len());
    for post in results {
        println!("{}", post.title);
        println!("-----------\n");
        println!("{}", post.body);
    }
}

vscode shows {unknown} when hovering over .limit(5) and the return type of results is also unknown. I'm using vscode version 1.85 with the latest rust-analyzer plugin.

@ohuu ohuu added the bug label Dec 12, 2023
@weiznich
Copy link
Member

Duplicate of rust-lang/rust-analyzer#14607 (It's a rust-analyzer bug, not a diesel issue.)

@weiznich weiznich closed this as not planned Won't fix, can't repro, duplicate, stale Dec 12, 2023
@cloud303-cholden
Copy link

@weiznich Is there a known workaround for this? Although it's an r-a issue, it's effect on diesel's DX is pretty big. Especially as a new user.

@weiznich
Copy link
Member

weiznich commented Jan 5, 2024

@cloud303-cholden There is no known workaround for this but I would be open to accept PR's for fixing this in diesel as long as they do not require a major version bump. But given that even the rust-analyzer developers cannot say which part of diesel is problematic (at least other than "the trait bounds") it's quite unlikely that anyone comes up with something on diesels side.

@cloud303-cholden
Copy link

@weiznich Before I possibly waste a lot of time screwing with my r-a setup, I'm assuming some combination of changing r-a and/or diesel version would resolve the issue, correct?

@weiznich
Copy link
Member

@cloud303-cholden Please don't ping me to ask this kind of questions, especially if that has already been answered before.

@ohuu
Copy link
Author

ohuu commented Jan 15, 2024

@cloud303-cholden You can use Rust Rover as a "work around" as long as you don't mind using a different IDE. When it comes to this particular bit of code analysis Rust Rover does a better job than Rust Analyzer (at least for now).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants